0

How to print pascal triangle perfectly using c

Pascal triangle

10th Sep 2019, 5:26 PM
Harsh Raj
Harsh Raj - avatar
7 Respostas
+ 4
Here is the pascal triangle program in the easiest and perfect way possible #include <stdio.h> int main() { // Program to print the pascal triangle //Coded by Satya int i,j,n,c,m; printf("Enter the no of rows for pascal triangle \n"); scanf("%d",&n); m=n-1; for(i=1;i<=n;i++) { c=1; for(j=1;j<=m;j++) { printf(" "); } for(j=1;j<=i;j++) { printf("%d",c); printf (" "); c=c*(i-j)/j; } printf("\n"); m--; } }
12th Apr 2020, 6:30 AM
S_P
S_P - avatar
0
I had tried but when double digit starts it is not going to look like a pattern. I gets disfigured. So i want to know that if there is any way to remove this disfigureness.
11th Sep 2019, 3:55 AM
Harsh Raj
Harsh Raj - avatar
11th Sep 2019, 10:22 PM
Hadeel Mamoun
0
https://code.sololearn.com/cG5zZEBaZhNH/?ref=app
12th Sep 2019, 6:53 PM
Harsh Raj
Harsh Raj - avatar
0
My pattern is not correct but i think that my algorith is correct
12th Sep 2019, 6:53 PM
Harsh Raj
Harsh Raj - avatar