Write a C program for pascal triangle.

 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;
}

NEED WORK PRODUCE WORK

My name is Abdul Rehman I am from Pakistan. I am doing BS in Computer and information sciences. Currently, I am creating these blogs to help students of computer sciences all over the world..

2 Comments

  1. As Always You Have shared a very Helpful information.

    ReplyDelete
  2. Can you kindly post a program of making a donut with alphabets as character.

    ReplyDelete
Post a Comment
Previous Post Next Post