-
Notifications
You must be signed in to change notification settings - Fork 9
/
pascal.c
37 lines (34 loc) · 982 Bytes
/
pascal.c
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
/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/
/*
* Original URL: http://www.c-program-example.com/2011/10/c-program-to-print-pascal-triangle.html
*/
/*
* GitHub URL: https://github.com/snadahalli/cprograms/blob/master/pascal.c
*/
#include"stdio.h"
int main()
{
int r, i, j, b, num;
printf("How many lines do you want?");
scanf("%d", &r);
b = r;
for(i=0;i<r;i++)
{
num = 1;
for(j=0;j<=i;j++)
{
printf("%d", num);
num = (num * (i-j)/(j+1));
}
printf("\n");
}
}