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.  
  8. /*int m;
  9.   printf("Enter the number of columns: \n");
  10.   scanf("%d",&m);*/
  11. int a=1;
  12. for(int i=1;i<=n;i++){
  13.  
  14. for(int j=1;j<=i;j++){
  15.  
  16.  
  17.  
  18. printf(" %d ",a);
  19.  
  20. a++;
  21.  
  22.  
  23. }
  24.  
  25. printf("\n");
  26. }
  27.  
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 5316KB
stdin
4

stdout
Enter the number of rows: 
 1 
 2  3 
 4  5  6 
 7  8  9  10