fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n;
  5.  
  6. printf("Enter the number of rows: \n");
  7. scanf("%d",&n);
  8. for(int i=1;i<=n;i++){
  9. for( int j=1;j<=n-i;j++){
  10.  
  11. printf(" ");
  12.  
  13. }
  14.  
  15. int y=65;
  16. for(int k=1;k<=i;k++){
  17. char ph=(char)y;
  18. printf(" %c ",y);
  19. y++;
  20. }
  21. int x =65;
  22. for(int d=i-1;d>=1;d--){
  23. char ch = (char)x;
  24. printf(" %c ",ch);
  25. x++;
  26. }
  27. printf("\n");
  28. }
  29.  
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0s 5280KB
stdin
5
stdout
Enter the number of rows: 
             A 
          A  B  A 
       A  B  C  A  B 
    A  B  C  D  A  B  C 
 A  B  C  D  E  A  B  C  D