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