Get a mirror image of the pattern on previous post.
This exercise is the same as previous, just print the columns..
here’s the code:
#include <stdio.h> int main() { int num,rows,cols; printf("Enter the rows:"); scanf("%d",&num); for(rows=1;rows<=num;rows++) { for(cols=1;cols=1;rows--) { for(cols=1;cols<=rows;cols++) { printf("%d",cols); } printf("\n"); } return 0; }
Looks like this when user enter 5:
Enter the rows:5
1
12
123
1234
12345
1234
123
12
1