2 3
4 5 6
7 8 9 10
11 12 13 14 15
Th efollowing is the code.
package com;
public class JavaProgram
{
public static void main(String args[])
{
int i, j, n=1;
for(i=0; i<5; i++)
{
for(j=0; j<=i; j++)
{
System.out.print(n+ " ");
n++;
}
System.out.println();
}
}
}
No comments:
Post a Comment