fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n;
  5. int d=1;
  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.  
  16. for(int k=1;k<2*i;k++){
  17.  
  18. printf(" %d ",d);
  19. d=d+1;
  20. }
  21. printf("\n");
  22. }
  23.  
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0.01s 5320KB
stdin
7
stdout
Enter the number of rows: 
                   1 
                2  3  4 
             5  6  7  8  9 
          10  11  12  13  14  15  16 
       17  18  19  20  21  22  23  24  25 
    26  27  28  29  30  31  32  33  34  35  36 
 37  38  39  40  41  42  43  44  45  46  47  48  49