// simple_paskal_trangle
import java.io.*;
class simple_pascal_triangle
{
public static void main(String args[])
{
try
{
int j,k,i=1,no;
DataInputStream cin=new DataInputStream(System.in);
System.out.println("enter the number of lines of pascal triangle");
no=Integer.parseInt(cin.readLine());
for(j=1;j<=no;j++)
{
for(k=1;k<=j;k++)
{
System.out.print(""+i);
System.out.print(" ");
i++;
}
System.out.println();
}
}
catch(Exception e)
{
System.out.println("wrong data");
}
}
}
No comments:
Post a Comment