C- Program To Generate Pascal's Triangle. Simple Program. Without Using any string funcitons
#include<stdio.h>#include<conio.h>void main(){int b,p,q,r,x;clrscr();printf("Enter the no. of rows : ");scanf("%d",&r);b=1;q=0;printf("\n\t\t\tPACSCAL'S TRINGLE\n");printf("\t\t\t-----------------\n");while(q<r){for(p=30-3*q;p>0;p--)printf(" ");for(x=0;x<=q;x++){if(x==0||q==0)b=1;elseb=(b*(q-x+1)/x);printf("%6d",b);}printf("\n");q++;}getch();}
|
Loading...
|
Comments :
Post a Comment
Enter any comments