Sunday, July 26, 2009

Need help in making a pascal triangle is turbo c?

Need help in making a pascal triangle is turbo c........


need the shortest code as possible....


tnx

Need help in making a pascal triangle is turbo c?
http://www.cs.ucl.ac.uk/staff/S.Bhatti/t...





http://www.chemie.fu-berlin.de/lehre/edv...





http://barnyard.syr.edu/quickies/pascal....
Reply://to get a pascal triangle


#include%26lt;stdio.h%26gt;


#include%26lt;conio.h%26gt;


main()


{


int a[20][20],i,j;


clrscr();


printf("Enter n");


scanf("%d",%26amp;n);


for(i=0;i%26lt;n;i++)


{


for(j=0;j%26lt;i+1;j++)


{


if(j==0||i==j)


a[i][j]=1;


else


a[i][j]=a[i-1][j]+a[i-1][j-1];


printf(" %d",a[i][j]);


}


printf("\n");


}


getch();


}





This is the simplest code.


If u need further help (if any), contact me via mails.


No comments:

Post a Comment