TASK-
Write a C program for pascal triangle.
OUTPUT:
CODE:
#include<stdio.h>
int main(){
int i,j,cof=1,s,n;
printf("Enter number of row: ");
scanf("%d",&n);
for (i=0;i<n;i++)
{
for (s=1;s<=(n+2)-i;s++)
{
printf(" ");
}
for (j=0;j<=i;j++)
{
if (i==0 || j==0)
cof=1;
else
cof=cof*(i-j+1)/j;
printf("%d ",cof);
}
printf("\n");
}
getchar();
return 0;
}
As Always You Have shared a very Helpful information.
ReplyDeleteCan you kindly post a program of making a donut with alphabets as character.
ReplyDelete