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