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.  
  12. for(int i=1;i<=n;i++){
  13. for(int j=1;j<=n;j++){
  14.  
  15. if(i>=j){
  16. int k=1;
  17. printf(" %d ",k);
  18. k++;
  19. }
  20. else printf(" ");
  21.  
  22. }
  23.  
  24. printf("\n");
  25. }
  26.  
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0.01s 5308KB
stdin
4

stdout
Enter the number of rows: 
 1          
 1  1       
 1  1  1    
 1  1  1  1