C program to print Pascal triangle using for loop

C program to print Pascal triangle using for loop


#include
int main(){
int line,i,j,k;
printf("Enter the no. of lines");
scanf("%d",&line);
for(i=1;i<=line;i++){
for(j=1;j<=line-i;j++)
printf(" ");
for(k=1;k printf("%d",k);
for(k=i;k>=1;k--)
printf("%d",k);
printf("\n");
}
return 0;
}



3 comments:

  1. please help
    i need c program to print no in this format using only two variales ....
    1
    1 2
    1 2 3
    1 2 3 4

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Who is this man??? Is this Pascal's Triangle?? LOL....

    ReplyDelete