Skip to content
Programmingoneonone
Programmingoneonone
  • Home
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programmingoneonone

C program to print a binomial coefficient table

YASH PAL, 31 July 2024

In this tutorial, we are going to write a C Program to print a binomial coefficient table in C Programming with practical program code and step-by-step full complete explanation.

C Program to print a binomial coefficient table

C Program to print a binomial coefficient table.

 
#include<stdio.h>
#include<conio.h>
#define MAX 10

void main()
{
    int m,x,binom;

    printf("mx ");
    for(m=0;m<=10;++m)
        printf("  %d ",m);
    printf("n--------------------------------------------------n");
    m=0;

    do
    {
        printf("%2d",m);
        x=0;
        binom=1;
        while(x<=m)
        {
            if(m==0 || x==0)
                printf("%4d",binom);
            else
            {
                binom=binom*(m-x+1)/x;
                printf("%4d",binom);
            }
            x=x+1;
        }
        printf("n");
        m=m+1;
    }
    while(m<=MAX);
    printf("-----------------------------------------------------");
}

Output

 
Mx  0   1   2   3   4   5   6   7   8   9   10
----------------------------------------------
0   1
1   1   1
2   1   2   1
3   1   3   3   1
4   1   4   6   4   1
5   1   5   10  10  5   1
6   1   6   15  20  15  6   1
7   1   7   21  35  35  21  7   1
8   1   8   28  56  70  56  28  8   1
9   1   9   36  84  126 126 84  36  9   1
10  1   10  45  120 210 252 210 120 45  10   1
c coding problems solutions

Post navigation

Previous post
Next post

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes