+ 1

I wanted to first increase a no. From 1 to 5 and then decrease it to 1 again using the same loop,but it isn't working.Pleasehelp

#include <stdio.h> void main() { int i,j,k; for(i=1;i<6;i++) { for(j=0;j<6-i;j++) { printf(" "); } j=1; do { printf(" %d",j); if(j<i) {j++; } if(j>i) {j--; } } while(j!=1); printf("\n"); } } I am trying to make 1 121 12321 1234321 123454321

1st Sep 2017, 1:32 AM
Deepank Puri
Deepank Puri - avatar
3 Antworten
1st Sep 2017, 2:41 AM
Mansi Dagla
Mansi Dagla - avatar
12th Oct 2017, 1:44 PM
Chandrakant More
Chandrakant More - avatar
1st Sep 2017, 2:24 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar