Question 22 : Write a program in Java to print the following pattern :
54321
4321
321
21
1
Java Program :
public class pattern_9
{
public static void main()
{
int i,j;
for(i=5;i>=1;i--)
{
for(j=i;j>=1;j--)
{
System.out.print(j);
}
System.out.print("\n");
}
}
}
No comments:
Post a Comment