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 d=65;
  16. for(int k=1;k<2*i;k++){
  17. char ch=(char)d;
  18. printf(" %c ",ch);
  19. d=d+1;
  20. }
  21. printf("\n");
  22. }
  23.  
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 5324KB
stdin
7
stdout
Enter the number of rows: 
                   A 
                A  B  C 
             A  B  C  D  E 
          A  B  C  D  E  F  G 
       A  B  C  D  E  F  G  H  I 
    A  B  C  D  E  F  G  H  I  J  K 
 A  B  C  D  E  F  G  H  I  J  K  L  M