fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n;
  5. printf("Enter the number of rows: \n");
  6. scanf("%d",&n);
  7. for(int i=1;i<=n;i++){
  8. for( int j=1;j<=n-i;j++){
  9.  
  10. printf(" ");
  11.  
  12. }
  13. int d=1;
  14.  
  15. for(int k=1;k<2*i;k++){
  16.  
  17. printf(" %d ",d);
  18. d++;
  19. }
  20. printf("\n");
  21. }
  22.  
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0.01s 5304KB
stdin
7
stdout
Enter the number of rows: 
                   1 
                1  2  3 
             1  2  3  4  5 
          1  2  3  4  5  6  7 
       1  2  3  4  5  6  7  8  9 
    1  2  3  4  5  6  7  8  9  10  11 
 1  2  3  4  5  6  7  8  9  10  11  12  13