fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n;// 12345
  5. // 12 45
  6. // 1 5
  7. printf("Enter the number of rows: \n");
  8. scanf("%d",&n);
  9.  
  10. int nsc=n-1;
  11. int nsp=1;
  12.  
  13. for(int r=1;r<=2*n-1;r++)
  14. printf("%d",r);
  15. printf("\n");
  16.  
  17. for(int i=1;i<=n;i++){
  18.  
  19. for(int j=1;j<=nsc;j++)
  20. printf("%d",j);
  21.  
  22. /* for(int k=1;k<=nsp;k++)
  23.   printf(" ");
  24.  
  25.   for(int j=1;j<=nst;j++)
  26.   printf("*");
  27.  
  28.   nst--;
  29.   nsp+=2;*/
  30.  
  31. printf("\n");
  32.  
  33. }
  34.  
  35. return 0;
  36. }
  37.  
Success #stdin #stdout 0.01s 5308KB
stdin
5
stdout
Enter the number of rows: 
123456789
1234
1234
1234
1234
1234