Chapter:

Pattern-Printing-in-C

C program to Print Pascal's triangle


           1

         1   1

       1   2 1

     1   3 3    1

   1  4   6 4   1

 1  5 10   10 5 1

In Pascal's triangle, each number is the sum of the two numbers directly above it.

C program to Print Pascal\'s triangle

#include<stdio.h>
int main()
 {
    int rows, coef=1, space, i, j;
    printf("Enter number of rows:\n");
    fflush(stdout);
    scanf("%d", &rows);
    for (i=0; i<rows; i++)
     {
        for (j=1; j<= rows-i; j++)
        {
            printf("  ");
        }
        for (j=0;....
Show More

All Chapters

View all Chapter and number of question available From each chapter from C-programming-