forked from ayush-8/C_programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProb1.txt
More file actions
40 lines (38 loc) · 633 Bytes
/
Prob1.txt
File metadata and controls
40 lines (38 loc) · 633 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <stdio.h>
int fact(int n)
{
int f = 1;
while (n >= 1)
{
f = f * n;
n--;
}
return (f);
}
int comb(int n, int r)
{
return (fact(n) / (fact(n - r) * fact(r)));
}
int main()
{
int i, j, k, l=0;
for (i = 1; i <= 5; i++)
{
k = 1;
l=0;
for (j = 1; j <= 9; j++)
{
if (j >= 6 - i && j <= 5 + i && k)
{
printf("%d",comb(i-1,l));
k = 0; l++;
}
else
{
printf(" ");
k = 1;
}
}
printf("\n");
}
}