NUMBER PYRAMID
import java.util.*;
class pyramid
{
public static void main()
{
int a,b,num,n;
Scanner sc=new Scanner(System.in);
System.out.print("Enter you how much row column you want : ");
n=sc.nextInt();
for (a=1;a<=n;a++)
{
num=1;
for (b=1;b<=a;b++)
{
System.out.print(num+" ");
num++;
}
System.out.println();
}
}
}
OUTPUT
0 Comments