wap in java to display the given pattern:-
*
**
***
****
*****
Answers
Answered by
0
Answer:
public class triangle
{
public static void main(String args[])
{
int i,j,row=5;
for(int i=0;i<=row;i++)
{
for(int j=0;j<=i;j++)
{
System.out.println("*");
}
}
}
}
Explanation:
Hey Friend, I hope you will like my program, I have made the program please like it and also mark my answer as brainliest..
Answered by
35
—› Your Program :
//Java program to display the given star pattern
import java.util.*;
public class pattern
{
public static void main (String args [] )
{
int i , j; //taking two variable to run the loop
for(i = 1; i<=5; i++)
{
for(j = 1; j<=i; j++)
{
System.out.print(" * ");
}
System.out.println();
}
}
}
------------------
—› Output :
*
* *
* * *
* * * *
* * * * *
Similar questions