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.  
  14. int d=1;
  15. for(int k=1;k<2*i;k++){
  16.  
  17. printf(" %d ",d);
  18. d=d+2;
  19. }
  20. printf("\n");
  21. }
  22.  
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 5320KB
stdin
7
stdout
Enter the number of rows: 
                   1 
                1  3  5 
             1  3  5  7  9 
          1  3  5  7  9  11  13 
       1  3  5  7  9  11  13  15  17 
    1  3  5  7  9  11  13  15  17  19  21 
 1  3  5  7  9  11  13  15  17  19  21  23  25