Monday, August 9, 2010

Article | Java Program To Pascal Triangls

Java Program To Pascal Triangles Without using any string functions/packages


import java.io.*;public class PascalTriangle{
public static void main(String args[])
{
try
{
System.out.print(" Enter no of rows : ");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int row=Integer.parseInt(br.readLine());
int b=1,q=0;
while(q0;p--)
System.out.print(" ");
for(int x=0;x<=q;x++)
{
if(x==0||q==0)
b=1;
else
b=(b*(q-x+1)/x);
System.out.print(b+" ");
}
System.out.print("\n\n");
q++;
}
}catch(Exception e){}
}
}
Loading...

Comments :

0 comments to “ Java Program To Pascal Triangls ”

Top Views

BloggerTipsTemplates

CHICKLETS

Enter your email address:

Delivered by FeedBurner

Followers