import java.io.*;
class simple_print_numeric_trangle_type4
{
public static void main(String args[])
{
try
{
int i,j,n;
DataInputStream cin=new DataInputStream(System.in);
System.out.println("enter the steps of trangle");
n=Integer.parseInt(cin.readLine());
for(i=n;i>=1;i--)
{
for(j=i;j>=1;j--)
{
System.out.print(j);
System.out.print(" ");
}
System.out.println();
if(i==5)
System.out.print(" ");
if(i==4)
System.out.print(" ");
if(i==3)
System.out.print(" ");
if(i==2)
System.out.print(" ");
if(i==1)
System.out.print(" ");
}
}
catch(Exception e)
{
System.out.println("wrong data");
}
}
}
No comments:
Post a Comment