fork(1) download
  1. #include <stdio.h>;
  2. #include <stdlib.h>;
  3.  
  4. void main() {
  5. unsigned long int x, y, z;
  6. printf("\nTHIS PROGRAM PRINTS ASCII PYRAMID \n");
  7. char c;
  8. y = 71;
  9. z = 12;
  10. for (int i = 0; i < 7; i++) {
  11.  
  12. for (int j = 65; j <= y; ++j) {
  13. printf("%c ", j); /*prints left side of the string */
  14. }
  15.  
  16. for (int k = 0; k < 2 * i; ++k) {
  17.  
  18. printf(" "); /*prints spaces between the strings */
  19. }
  20. for (int l = y; l > 64; l--) {
  21. if (l == 71) {
  22. for (int p = 70; p > 64; p--)
  23. printf("%c ", i);
  24. } else
  25. printf("%c ", l); /* prints right part of the string */
  26. };
  27. y = y - 1;
  28. printf("\n");
  29. }
  30. }
Runtime error #stdin #stdout 0s 4260KB
stdin
Standard input is empty
stdout
THIS PROGRAM PRINTS ASCII PYRAMID 
A B C D E F G       F E D C B A 
A B C D E F     F E D C B A 
A B C D E         E D C B A 
A B C D             D C B A 
A B C                 C B A 
A B                     B A 
A                         A