Solving simple scientific and statistical problems - Basic C Program
Solving simple scientific and statistical problems
C Program to print Table of Binomial Coefficients.
The Binomial coefficients are used to study the binomial distributions.
It is given by B(m, x) =
, m >= x
A table of binomial coefficients is required to determine the binomial coefficient for any set of 'm' and 'x'. The binomial coefficient can be recursively calculated as follows:
B(m, o)=1, B(m, x)=B(m,x‒1) [(m‒x+1) / x ] , ,x=1, 2, 3, ..., m, B(0,0)=1
That is, the binomial coefficient is one, when either 'x' is zero or 'm' is zero.
/*Program to print table of binomial coefficients */
#include <stdio.h>
main()
{
int m,x, bin;
printf("mx");
for(m=0;m<=5;m++)
printf("%4d",m);
printf("\n‒‒‒‒‒‒‒‒‒‒‒‒\n");
m=0;
do
{ printf("%2d", m);
x=0;
bin=1;
while(x<=m)
{
if(m==0||x==0)
printf("%4d", bin);
else
{
bin=bin*(m‒x+1)/x;
printf("%4d", bin);
} /* if else */
x=x+1;
}/* while */
printf("\n");
m=m+1;
} /* do */
while(m<=5);
printf("\n‒‒‒‒‒‒‒‒‒‒‒‒\n");
} /* main
OUTPUT
mx 0 1 2 3 4 5
‒ ‒ ‒ ‒ ‒ ‒ ‒ ‒ ‒
0 1
1 1
2 1 1
3 1 2 1
4 1 3 3 1
5 1 4 6 4 1
1 1 5 10 10 5 1
‒ ‒ ‒ ‒ ‒ ‒ ‒ ‒ ‒
Computer Programming C Laboratory: Basic C Programs : Tag: C Programming : - C Program to print Table of Binomial Coefficients
Computer Programming C Laboratory
CS25C01 1st Semester EEE, ECE, CSE, CSE(CY), AIDS, IT practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
English Essentials I
EN25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
தமிழர் மரபு - Heritage of Tamils
UC25H01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Applied Calculus
MA25C01 Maths 1 M1 - 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Applied Physics I
PH25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Applied Chemistry I
CY25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Makerspace
ME25C04 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Computer Programming C
CS25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Computer Programming Python
CS25C02 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation
Fundamentals of Electrical and Electronics Engineering
EE25C03 1st Semester EEE Depart | 2025 Regulation | 1st Semester 2025 Regulation
Introduction to Mechanical Engineering
ME25C03 1st Semester Mechanical Dept | 2025 Regulation | 1st Semester 2025 Regulation
Introduction to Civil Engineering
CE25C01 1st Semester Civil, Agri Departments | 2025 Regulation | 1st Semester 2025 Regulation
Essentials of Computing
CS25C03 1st Semester - AIDS, CSE, CSE(CY), IT Department | 2025 Regulation | 1st Semester 2025 Regulation
Applied Physics I Laboratory
PH25C01 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
Applied Chemistry I Laboratory
CY25C01 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
Computer Programming C Laboratory
CS25C01 1st Semester EEE, ECE, CSE, CSE(CY), AIDS, IT practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
Computer Programming Python Laboratory
CS25C02 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation
Engineering Drawing
ME25C01 EEE, Mech, Agri, EEE Depts | 2025 Regulation | 2nd Semester 2025 Regulation
Basic Electronics and Electrical Engineering
EE25C04 1st Semester ECE Dept | 2025 Regulation | 1st Semester 2025 Regulation
Essentials of Computing - Laboratory
CS25C03 1st Semester AIDS, CSE, CSE(CY), IT Depts | practical Laboratory Manual | 2025 Regulation | 1st Semester 2025 Regulation