Header Ads

How to print pascal triangle in this sequence in C

------------------------------------------Program------------------------------------------------


#include<stdio.h>
#include<conio.h>
main()
{
    int i,j,k,n;
    printf("Enter the number of row : ");
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=n-i;j++)
        {
            printf(" ");
        }
        for(k=1;k<=i;k++)
        printf("%d ",i);
        printf("\n");
    }
    getch();
}


------------------------------------------Output--------------------------------------------------


Screenshot of above pascal triangle program

No comments