Java Program for printing pyramid of 10 numbers, Write a java program that display pyramid of 10 numbers
Program
class pyramid
{
public static void main(String args[])
{
for(int i=1;i<=10;i++)
{
for(int s=20;s>=i;s--)
{
System.out.print(" ");
}
for(int j=1;j<=i;j++)
{
System.out.print(" "+j+" ");
}
System.out.println();
}
}
}
No comments:
Post a Comment