fork download
  1. //Q49. 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() {
  10. int n = 5;
  11.  
  12. for (int i = n; i >= 1; i--) {
  13. for (int j = i; j <= n; j++) {
  14. printf("%d", j);
  15. }
  16. printf("\n");
  17. }
  18.  
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
5
45
345
2345
12345