Question 25 : Write a program in Java to print the following pattern :
5
45
345
2345
12345
Java Program :
public class pattern_12
{
public static void main()
{
int i,j;
for(i=5;i>=1;i--)
{
for(j=i;j<=5;j++)
{
System.out.print(j);
}
System.out.print("\n");
}
}
}
No comments:
Post a Comment