fork download
  1. //Q51 Write a program to print the following pattern:
  2. // 5
  3. // 45
  4. //345
  5. //2345
  6. //12345
  7. #include <stdio.h>
  8.  
  9. int main(void) {
  10. int n = 5;
  11.  
  12. for (int i = n; i >= 1; --i) {
  13.  
  14. for (int s = 0; s < i - 1; ++s) putchar(' ');
  15.  
  16. for (int j = i; j <= n; ++j) printf("%d", j);
  17. putchar('\n');
  18. }
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
    5
   45
  345
 2345
12345