1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
The following is the code.
package com;
public class JavaProgram
{
public static void main(String args[])
{
int i, j, num;
for(i=0; i<5; i++)
{
num=1;
for(j=0; j<=i; j++)
{
System.out.print(num+ " ");
num++;
}
System.out.println();
}
}
}
No comments:
Post a Comment