Hey Guys,
Today we discussed about For Loop Pattern Program in Java.Pattern program.
Example ↬ Pattern 3.
class Main
{
public static void main (String[] args)
{
int i,j;
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
System.out.print(" ");
}
for(j=1;j<=i;j++)
{
System.out.print("*");
}
System.out.println();
}
}
}
Output :-
*
**
***
****
*****
0 Comments
Post a Comment