Asterisk: PVS-Studio Takes Up TelephonyAndrey Karpov
Asterisk is a software implementation of a telephone private branch exchange (PBX); it was created in 1999 by Mark Spencer of Digium. Like any PBX, it allows attached telephones to make calls to one another, and to connect to other telephone services, such as the public switched telephone network (PSTN) and Voice over Internet Protocol (VoIP) services. Its name comes from the asterisk symbol, *.
Asterisk is released under a dual license model, using the GNU General Public License (GPL) as a free software license and a proprietary software license to permit licensees to distribute proprietary, unpublished system components.
In this article, we are going to discuss the results of the check of the Asterisk project by PVS-Studio 5.18.
The project seems to be regularly checked by the Coverity analyzer, which is indicated by comments like this one:
/* Ignore check_return warning from Coverity for ast_exists_extension below */
However, I still found some disappointing typos in the code. Let's try to figure them out as well as other potential issues. The source code was downloaded from the project's SVN repository.
I am Wycliffe S. I am a Python Homework Expert at pythonhomeworkhelp.com. I hold a Master's in Computer Science from, the University of Aberdeen, UK. I have been helping students with their homework for the past 13 years. I solve homework related to Python.
Visit pythonhomeworkhelp.com or email support@pythonhomeworkhelp.com. You can also call on +1 678 648 4277 for any assistance with Python Homework.
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...ssuserd6b1fd
C programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...ssuserd6b1fd
C++ programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
Asterisk: PVS-Studio Takes Up TelephonyAndrey Karpov
Asterisk is a software implementation of a telephone private branch exchange (PBX); it was created in 1999 by Mark Spencer of Digium. Like any PBX, it allows attached telephones to make calls to one another, and to connect to other telephone services, such as the public switched telephone network (PSTN) and Voice over Internet Protocol (VoIP) services. Its name comes from the asterisk symbol, *.
Asterisk is released under a dual license model, using the GNU General Public License (GPL) as a free software license and a proprietary software license to permit licensees to distribute proprietary, unpublished system components.
In this article, we are going to discuss the results of the check of the Asterisk project by PVS-Studio 5.18.
The project seems to be regularly checked by the Coverity analyzer, which is indicated by comments like this one:
/* Ignore check_return warning from Coverity for ast_exists_extension below */
However, I still found some disappointing typos in the code. Let's try to figure them out as well as other potential issues. The source code was downloaded from the project's SVN repository.
I am Wycliffe S. I am a Python Homework Expert at pythonhomeworkhelp.com. I hold a Master's in Computer Science from, the University of Aberdeen, UK. I have been helping students with their homework for the past 13 years. I solve homework related to Python.
Visit pythonhomeworkhelp.com or email support@pythonhomeworkhelp.com. You can also call on +1 678 648 4277 for any assistance with Python Homework.
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...ssuserd6b1fd
C programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...ssuserd6b1fd
C++ programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
import java.util.Scanner;public class ArrayOperation { inp.pdfangelsfashion1
import java.util.Scanner;
public class ArrayOperation {
/* input method implementation */
public static double[] input() {
Scanner sc = new Scanner(System.in);
System.out.println(\"Please enter the size of array\");
int n = sc.nextInt();
double number[] = new double[n];
/* Inserting element to array */
for (int i = 0; i < n; i++) {
number[i] = sc.nextDouble();
}
/* printing array by calling print method */
print(number);
return number;
}
public static void print(double number[]) {
/* Printing array */
for (int i = 0; i < number.length; i++) {
System.out.print(number[i] + \" \");
}
System.out.println();
}
/* sqrtnumber method implemantation */
public static void sqrtNumber(double number[]) {
/* Printing sqrt of numbers */
System.out.println(\"Square root of Number of an array\");
for (int i = 0; i < number.length; i++) {
double num = Math.sqrt(number[i]);
System.out.println(num);
}
}
public static void main(String args[]) {
/* Calling initaize array */
double number[] = input();
/* calling sqrtnumber */
sqrtNumber(number);
}
}
/***********output*****************/
Please enter the size of array
5
5
6
7
8
14
5.0 6.0 7.0 8.0 14.0
Square root of Number of an array
2.23606797749979
2.449489742783178
2.6457513110645907
2.8284271247461903
3.7416573867739413
Solution
import java.util.Scanner;
public class ArrayOperation {
/* input method implementation */
public static double[] input() {
Scanner sc = new Scanner(System.in);
System.out.println(\"Please enter the size of array\");
int n = sc.nextInt();
double number[] = new double[n];
/* Inserting element to array */
for (int i = 0; i < n; i++) {
number[i] = sc.nextDouble();
}
/* printing array by calling print method */
print(number);
return number;
}
public static void print(double number[]) {
/* Printing array */
for (int i = 0; i < number.length; i++) {
System.out.print(number[i] + \" \");
}
System.out.println();
}
/* sqrtnumber method implemantation */
public static void sqrtNumber(double number[]) {
/* Printing sqrt of numbers */
System.out.println(\"Square root of Number of an array\");
for (int i = 0; i < number.length; i++) {
double num = Math.sqrt(number[i]);
System.out.println(num);
}
}
public static void main(String args[]) {
/* Calling initaize array */
double number[] = input();
/* calling sqrtnumber */
sqrtNumber(number);
}
}
/***********output*****************/
Please enter the size of array
5
5
6
7
8
14
5.0 6.0 7.0 8.0 14.0
Square root of Number of an array
2.23606797749979
2.449489742783178
2.6457513110645907
2.8284271247461903
3.7416573867739413.
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxmary772
CodeZip/ButtonDemo.javaCodeZip/ButtonDemo.java// Demonstrate a push button and handle action events.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
publicclassButtonDemoimplementsActionListener{
JLabel jlab;
JTextField jtf;
ButtonDemo(){
// Create a new JFrame container.
JFrame jfrm =newJFrame("A Button Example");
// Specify FlowLayout for the layout manager.
jfrm.setLayout(newFlowLayout());
// Give the frame an initial size.
jfrm.setSize(220,90);
// Terminate the program when the user closes the application.
jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Make two buttons.
JButton jbtnUp =newJButton("Up");
JButton jbtnDown =newJButton("Down");
// Create a text field.
jtf =newJTextField(10);
// Add action listeners.
jbtnUp.addActionListener(this);
jbtnDown.addActionListener(this);
// Add the buttons to the content pane.
jfrm.add(jbtnUp);
jfrm.add(jbtnDown);
jfrm.add(jtf);
// Create a label.
jlab =newJLabel("Press a button.");
// Add the label to the frame.
jfrm.add(jlab);
// Display the frame.
jfrm.setVisible(true);
}
// Handle button events.
publicvoid actionPerformed(ActionEvent ae){
if(ae.getActionCommand().equals("Up")){
jlab.setText("You pressed Up.");
FileClock clock1=newFileClock(jtf);
Thread thread1=newThread(clock1);
thread1.start();
}
else
jlab.setText("You pressed down. ");
}
publicstaticvoid main(String args[]){
// Create the frame on the event dispatching thread.
SwingUtilities.invokeLater(newRunnable(){
publicvoid run(){
newButtonDemo();
}
});
}
}
CodeZip/CBDemo.javaCodeZip/CBDemo.java// Demonstrate check boxes.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
publicclassCBDemoimplementsItemListener{
JLabel jlabSelected;
JLabel jlabChanged;
JCheckBox jcbAlpha;
JCheckBox jcbBeta;
JCheckBox jcbGamma;
CBDemo(){
// Create a new JFrame container.
JFrame jfrm =newJFrame("Demonstrate Check Boxes");
// Specify FlowLayout for the layout manager.
jfrm.setLayout(newFlowLayout());
// Give the frame an initial size.
jfrm.setSize(280,120);
// Terminate the program when the user closes the application.
jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create empty labels.
jlabSelected =newJLabel("");
jlabChanged =newJLabel("");
// Make check boxes.
jcbAlpha =newJCheckBox("Alpha");
jcbBeta =newJCheckBox("Beta");
jcbGamma =newJCheckBox("Gamma");
// Events generated by the check boxes
// are handled in common by the itemStateChanged()
// method implemented by CBDemo.
jcbAlpha.addItemListener(this);
jcbBeta.addItemListener(this);
jcbGamma.addItemListener(this);
// Add checkboxes and labels to the content pane.
jfrm.add(jcbAlpha);
jfrm.add(jcbBeta);
jfrm.add(jcbGamma);
jfrm.add(jlabChanged);
jfrm.add(jlabSelected);
// Display the frame.
jfrm.setVisible(true);
}
// This is the handler for the check boxes..
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxmccormicknadine86
CodeZip/ButtonDemo.javaCodeZip/ButtonDemo.java// Demonstrate a push button and handle action events.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
publicclassButtonDemoimplementsActionListener{
JLabel jlab;
JTextField jtf;
ButtonDemo(){
// Create a new JFrame container.
JFrame jfrm =newJFrame("A Button Example");
// Specify FlowLayout for the layout manager.
jfrm.setLayout(newFlowLayout());
// Give the frame an initial size.
jfrm.setSize(220,90);
// Terminate the program when the user closes the application.
jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Make two buttons.
JButton jbtnUp =newJButton("Up");
JButton jbtnDown =newJButton("Down");
// Create a text field.
jtf =newJTextField(10);
// Add action listeners.
jbtnUp.addActionListener(this);
jbtnDown.addActionListener(this);
// Add the buttons to the content pane.
jfrm.add(jbtnUp);
jfrm.add(jbtnDown);
jfrm.add(jtf);
// Create a label.
jlab =newJLabel("Press a button.");
// Add the label to the frame.
jfrm.add(jlab);
// Display the frame.
jfrm.setVisible(true);
}
// Handle button events.
publicvoid actionPerformed(ActionEvent ae){
if(ae.getActionCommand().equals("Up")){
jlab.setText("You pressed Up.");
FileClock clock1=newFileClock(jtf);
Thread thread1=newThread(clock1);
thread1.start();
}
else
jlab.setText("You pressed down. ");
}
publicstaticvoid main(String args[]){
// Create the frame on the event dispatching thread.
SwingUtilities.invokeLater(newRunnable(){
publicvoid run(){
newButtonDemo();
}
});
}
}
CodeZip/CBDemo.javaCodeZip/CBDemo.java// Demonstrate check boxes.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
publicclassCBDemoimplementsItemListener{
JLabel jlabSelected;
JLabel jlabChanged;
JCheckBox jcbAlpha;
JCheckBox jcbBeta;
JCheckBox jcbGamma;
CBDemo(){
// Create a new JFrame container.
JFrame jfrm =newJFrame("Demonstrate Check Boxes");
// Specify FlowLayout for the layout manager.
jfrm.setLayout(newFlowLayout());
// Give the frame an initial size.
jfrm.setSize(280,120);
// Terminate the program when the user closes the application.
jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Create empty labels.
jlabSelected =newJLabel("");
jlabChanged =newJLabel("");
// Make check boxes.
jcbAlpha =newJCheckBox("Alpha");
jcbBeta =newJCheckBox("Beta");
jcbGamma =newJCheckBox("Gamma");
// Events generated by the check boxes
// are handled in common by the itemStateChanged()
// method implemented by CBDemo.
jcbAlpha.addItemListener(this);
jcbBeta.addItemListener(this);
jcbGamma.addItemListener(this);
// Add checkboxes and labels to the content pane.
jfrm.add(jcbAlpha);
jfrm.add(jcbBeta);
jfrm.add(jcbGamma);
jfrm.add(jlabChanged);
jfrm.add(jlabSelected);
// Display the frame.
jfrm.setVisible(true);
}
// This is the handler for the check boxes. ...
Gary Bernhardt’s famous WAT talk pokes fun at the weird things in Ruby and JavaScript due to weak typing and operator overloading. But Go can be strange, too. It has its own odd behaviors, some of which we run into every day. Learning about Go’s corner cases teaches us how Go works under the covers.
operating system ubuntu,linux,MacProgram will work only if you g.pdfaptcomputerzone
//operating system ubuntu,linux,Mac
Program will work only if you give command like
sum 2 3 or
sum 4 (sub 4 3)
#include
#include
#include
#include
/*Sum function implementation*/
int sum(int number1,int number2){
return number1+number2;
}
/*sub function implementation*/
int sub(int number1,int number2){
return number1-number2;
}
/*mul function implementation*/
int mul(int number1,int number2){
return number1*number2;
}
/*divide function implementation*/
float divide(int number1,int number2){
if(number2==0){
printf(\"We can not divide by 0 \ \");
return 0.0f;
}
return (float)(number1/number2);
}
char *substring(char *string, int position, int length)
{
char *pointer;
int c;
pointer = malloc(length+1);
if (pointer == NULL)
{
printf(\"Unable to allocate memory.\ \");
exit(1);
}
for (c = 0 ; c < length ; c++)
{
*(pointer+c) = *(string+position-1);
string++;
}
*(pointer+c) = \'\\0\';
return pointer;
}
/*Main Function start*/
int main(int argc, char *argv[]){
/*Variable declarations*/
int number1,number2;
char *operator,*str1,*str2;
char line[50];
char s[2] = \" \";
int errorFlag=0;// checking if user entered more then one operands
while(1){
/*User input*/
printf(\"Please Enter the command \");
gets(line);
int len=0;
for(int i=0; line[i]!=\'\\0\'; ++i){len++;}
if(len==0){
return 1;
}
/*Spliting into Tokens*/
operator = strtok(line, \" \");
if(strcmp(operator,\"bye\")==0){
break;
}
/*String to integer --- token1*/
number1=atoi(strtok(NULL, s));
/*Removing ( and ) from String*/
str2=strtok(NULL, s);
char *content;int length=0;
for(int i=0; str2[i]!=\'\\0\'; ++i){length++;}
if(str2[0]==\'(\'){
content=substring(str2,2,length-1);
char *opr=content;
int n1=atoi(strtok(NULL, s));
int n2=atoi(strtok(NULL, s));
/*If user entered more then two operands then it will return some token otherwise it will
return NULL pointer*/
if(strtok(NULL, s)!=NULL){
printf(\"You need to enter operator operand1 operand2 \ \");
errorFlag=1;
}else{
if(strcmp(opr,\"sum\")==0){
number2=sum(n1,n2);
}else if(strcmp(opr,\"sub\")==0){
number2=sub(n1,n2);
}else if(strcmp(opr,\"mul\")==0){
number2=mul(n1,n2);
} else if(strcmp(opr,\"div\")==0){
number2=divide(n1,n2);
}
}
}else{
number2=atoi(str2);
/*If user entered more then two operands then it will return some token otherwise it will return
NULL pointer*/
if(strtok(NULL, s)!=NULL){
printf(\"You need to enter operator operand1 operand2 \ \");
errorFlag=1;
}
}
if(errorFlag!=1){
/*Checking operator by strcmp function*/
if(strcmp(operator,\"sum\")==0){
printf(\"Result %d \ \",sum(number1,number2));
}else if(strcmp(operator,\"sub\")==0){
printf(\"Result %d \ \",sub(number1,number2));
}else if(strcmp(operator,\"mul\")==0){
printf(\"Result %d \ \",mul(number1,number2));
} else if(strcmp(operator,\"div\")==0){
printf(\"Result %.2f \ \",divide(number1,number2));
}
}
}
return 0;
}
/*******************Output***********************/
gopal@gopal:~/Desktop/chegg$ gcc Calculator.c
Calculator.c: In function ‘main’:
Calculator.c:67:3: warning: implici.
Similar to Print Star pattern in java and print triangle of stars in java (20)
The Evolution of Non-Banking Financial Companies (NBFCs) in India: Challenges...beulahfernandes8
Role in Financial System
NBFCs are critical in bridging the financial inclusion gap.
They provide specialized financial services that cater to segments often neglected by traditional banks.
Economic Impact
NBFCs contribute significantly to India's GDP.
They support sectors like micro, small, and medium enterprises (MSMEs), housing finance, and personal loans.
The European Unemployment Puzzle: implications from population agingGRAPE
We study the link between the evolving age structure of the working population and unemployment. We build a large new Keynesian OLG model with a realistic age structure, labor market frictions, sticky prices, and aggregate shocks. Once calibrated to the European economy, we quantify the extent to which demographic changes over the last three decades have contributed to the decline of the unemployment rate. Our findings yield important implications for the future evolution of unemployment given the anticipated further aging of the working population in Europe. We also quantify the implications for optimal monetary policy: lowering inflation volatility becomes less costly in terms of GDP and unemployment volatility, which hints that optimal monetary policy may be more hawkish in an aging society. Finally, our results also propose a partial reversal of the European-US unemployment puzzle due to the fact that the share of young workers is expected to remain robust in the US.
what is the best method to sell pi coins in 2024DOT TECH
The best way to sell your pi coins safely is trading with an exchange..but since pi is not launched in any exchange, and second option is through a VERIFIED pi merchant.
Who is a pi merchant?
A pi merchant is someone who buys pi coins from miners and pioneers and resell them to Investors looking forward to hold massive amounts before mainnet launch in 2026.
I will leave the telegram contact of my personal pi merchant to trade pi coins with.
@Pi_vendor_247
Even tho Pi network is not listed on any exchange yet.
Buying/Selling or investing in pi network coins is highly possible through the help of vendors. You can buy from vendors[ buy directly from the pi network miners and resell it]. I will leave the telegram contact of my personal vendor.
@Pi_vendor_247
how to sell pi coins in all Africa Countries.DOT TECH
Yes. You can sell your pi network for other cryptocurrencies like Bitcoin, usdt , Ethereum and other currencies And this is done easily with the help from a pi merchant.
What is a pi merchant ?
Since pi is not launched yet in any exchange. The only way you can sell right now is through merchants.
A verified Pi merchant is someone who buys pi network coins from miners and resell them to investors looking forward to hold massive quantities of pi coins before mainnet launch in 2026.
I will leave the telegram contact of my personal pi merchant to trade with.
@Pi_vendor_247
how can I sell pi coins after successfully completing KYCDOT TECH
Pi coins is not launched yet in any exchange 💱 this means it's not swappable, the current pi displaying on coin market cap is the iou version of pi. And you can learn all about that on my previous post.
RIGHT NOW THE ONLY WAY you can sell pi coins is through verified pi merchants. A pi merchant is someone who buys pi coins and resell them to exchanges and crypto whales. Looking forward to hold massive quantities of pi coins before the mainnet launch.
This is because pi network is not doing any pre-sale or ico offerings, the only way to get my coins is from buying from miners. So a merchant facilitates the transactions between the miners and these exchanges holding pi.
I and my friends has sold more than 6000 pi coins successfully with this method. I will be happy to share the contact of my personal pi merchant. The one i trade with, if you have your own merchant you can trade with them. For those who are new.
Message: @Pi_vendor_247 on telegram.
I wouldn't advise you selling all percentage of the pi coins. Leave at least a before so its a win win during open mainnet. Have a nice day pioneers ♥️
#kyc #mainnet #picoins #pi #sellpi #piwallet
#pinetwork
Seminar: Gender Board Diversity through Ownership NetworksGRAPE
Seminar on gender diversity spillovers through ownership networks at FAME|GRAPE. Presenting novel research. Studies in economics and management using econometrics methods.
how to swap pi coins to foreign currency withdrawable.DOT TECH
As of my last update, Pi is still in the testing phase and is not tradable on any exchanges.
However, Pi Network has announced plans to launch its Testnet and Mainnet in the future, which may include listing Pi on exchanges.
The current method for selling pi coins involves exchanging them with a pi vendor who purchases pi coins for investment reasons.
If you want to sell your pi coins, reach out to a pi vendor and sell them to anyone looking to sell pi coins from any country around the globe.
Below is the contact information for my personal pi vendor.
Telegram: @Pi_vendor_247
BYD SWOT Analysis and In-Depth Insights 2024.pptxmikemetalprod
Indepth analysis of the BYD 2024
BYD (Build Your Dreams) is a Chinese automaker and battery manufacturer that has snowballed over the past two decades to become a significant player in electric vehicles and global clean energy technology.
This SWOT analysis examines BYD's strengths, weaknesses, opportunities, and threats as it competes in the fast-changing automotive and energy storage industries.
Founded in 1995 and headquartered in Shenzhen, BYD started as a battery company before expanding into automobiles in the early 2000s.
Initially manufacturing gasoline-powered vehicles, BYD focused on plug-in hybrid and fully electric vehicles, leveraging its expertise in battery technology.
Today, BYD is the world’s largest electric vehicle manufacturer, delivering over 1.2 million electric cars globally. The company also produces electric buses, trucks, forklifts, and rail transit.
On the energy side, BYD is a major supplier of rechargeable batteries for cell phones, laptops, electric vehicles, and energy storage systems.
Currently pi network is not tradable on binance or any other exchange because we are still in the enclosed mainnet.
Right now the only way to sell pi coins is by trading with a verified merchant.
What is a pi merchant?
A pi merchant is someone verified by pi network team and allowed to barter pi coins for goods and services.
Since pi network is not doing any pre-sale The only way exchanges like binance/huobi or crypto whales can get pi is by buying from miners. And a merchant stands in between the exchanges and the miners.
I will leave the telegram contact of my personal pi merchant. I and my friends has traded more than 6000pi coins successfully
Tele-gram
@Pi_vendor_247
Turin Startup Ecosystem 2024 - Ricerca sulle Startup e il Sistema dell'Innov...Quotidiano Piemontese
Turin Startup Ecosystem 2024
Una ricerca de il Club degli Investitori, in collaborazione con ToTeM Torino Tech Map e con il supporto della ESCP Business School e di Growth Capital
Which Crypto to Buy Today for Short-Term in May-June 2024.pdf
Print Star pattern in java and print triangle of stars in java
1. Programs for printing pyramid patterns in Java
This article is aimed at giving a Java implementation for pattern printing.
Simple pyramid pattern
filter_none
edit
play_arrow
brightness_4
import java.io.*;
// Java code to demonstrate star patterns
public class My_Class
{
// Function to demonstrate printing pattern
public static void printStars(int n)
{
int i, j;
// outer loop to handle number of rows
// n in this case
for(i=0; i<n; i++)
{
// inner loop to handle number of columns
// values changing acc. to outer loop
for(j=0; j<=i; j++)
{
2. // printing stars
System.out.print("* ");
}
// ending line after each row
System.out.println();
}
}
// Driver Function
public static void main(String args[])
{
int n = 5;
printStars(n);
}
}
Output:
*
* *
* * *
* * * *
* * * * *
After 180 degree rotation
3. filter_none
edit
play_arrow
brightness_4
import java.io.*;
// Java code to demonstrate star pattern
public class My_Class
{
// Function to demonstrate printing pattern
public static void printStars(int n)
{
int i, j;
// outer loop to handle number of rows
// n in this case
for(i=0; i<n; i++)
{
// inner loop to handle number spaces
// values changing acc. to requirement
for(j=2*(n-i); j>=0; j--)
{
// printing spaces
System.out.print(" ");
}
4. // inner loop to handle number of columns
// values changing acc. to outer loop
for(j=0; j<=i; j++)
{
// printing stars
System.out.print("* ");
}
// ending line after each row
System.out.println();
}
}
// Driver Function
public static void main(String args[])
{
int n = 5;
printStars(n);
}
}
Output:
*
* *
* * *
* * * *
* * * * *
Printing Triangle
5. filter_none
edit
play_arrow
brightness_4
import java.io.*;
// Java code to demonstrate star pattern Print Star pattern in Java
public class My_Class
{
// Function to demonstrate printing pattern
public static void printTriagle(int n)
{
// outer loop to handle number of rows
// n in this case
for (int i=0; i<n; i++)
{
// inner loop to handle number spaces
// values changing acc. to requirement
for (int j=n-i; j>1; j--)
{
// printing spaces
System.out.print(" ");
}
// inner loop to handle number of columns
// values changing acc. to outer loop
6. for (int j=0; j<=i; j++ )
{
// printing stars
System.out.print("* ");
}
// ending line after each row
System.out.println();
}
}
// Driver Function
public static void main(String args[])
{
int n = 5;
printTriagle(n);
}
}
Output:
*
* *
* * *
* * * *
* * * * *
Number Pattern
filter_none
7. edit
play_arrow
brightness_4
import java.io.*;
// Java code to demonstrate number pattern
public class My_Class
{
// Function to demonstrate printing pattern
public static void printNums(int n)
{
int i, j,num;
// outer loop to handle number of rows
// n in this case
for(i=0; i<n; i++)
{
// initialising starting number
num=1;
// inner loop to handle number of columns
// values changing acc. to outer loop
for(j=0; j<=i; j++)
{
// printing num with a space
System.out.print(num+ " ");
//incrementing value of num
8. num++;
}
// ending line after each row
System.out.println();
}
}
// Driver Function
public static void main(String args[])
{
int n = 5;
printNums(n);
}
}
Output:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Numbers without re assigning
filter_none
edit
play_arrow
9. brightness_4
import java.io.*;
// Java code to demonstrate star pattern
public class My_Class
{
// Function to demonstrate printing pattern
public static void printNums(int n)
{
// initialising starting number
int i, j, num=1;
// outer loop to handle number of rows
// n in this case
for(i=0; i<n; i++)
{
// without re assigning num
// num = 1;
for(j=0; j<=i; j++)
{
// printing num with a space
System.out.print(num+ " ");
// incrementing num at each column
num = num + 1;
}
// ending line after each row