C Programs

Write a C program which prints Pascal triangle?


/* C program which prints Pascal triangle */
#include<stdio.h>
#include<conio.h>

int main(){
    int number,i,j,rows = 15; /* give input here*/
    clrscr();
    for (i = 0; i < rows; i++) {
         number = 1;
         gotoxy((rows - i) * 2, i+2);
         /* to keep distance from initial*/
         for (j = 1; j <= i; j++) {
                printf("%4d", number);
                number = number * (i - j) /j;
         }
         printf("\n");
    }   
    getch();
    return 0;
}

www.000webhost.com