Posts

Showing posts with the label Q. Write a C program to generate pascal triangle or Write a C program to print following number triangle

Q. Write a C program to generate pascal triangle or Write a C program to print following number triangle :

Image
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 Solution: #include< stdio.h > #include< conio.h > void main() {     int a,b,i,j,d[30],t[30];     clrscr();     printf (" Enter the max limit: ");          scanf ("%d",&a);     b=a;     for (i=0;i< a;i++)     { //Initialisation..         t[0]=1; t[i]=1; d[0]=1; //Spacing..          for (j=0;j< b-1;j++)             printf (" ");         b--; //Calculation..          for (j=1;j<=i;j++)         {         d[j]=t[j-1]+t[j];         }         d...