Saturday, June 18, 2016

C Program Code: Print Pascal Triangle

C Program Code:

#include <stdio.h>
#include <conio.h>
int main()
{
    int size,space;
    int i,j;
    printf("Print Pascal Triangle in C \n");
    printf("Enter Size : ");
    scanf("%d",&size);
    for(i=1; i<=size; i++)
    {
        for(space=1; space<=size-i; space++)
        {
            printf(" ");
        }
        for(j=1; j<=2*i-1; j++)
        {
            printf("*");
        }
        printf("\n");
    }
getch();
return 0;
}

Print Pascal Triangle in C Output Screenshot