fork download
  1. /* Write a program to take n as input and print 1 to n in the following order.
  2.  * 1
  3.  * 1 2
  4.  * 1 2 3
  5.  * 1 2 3 4
  6.  * 1 2 3 4 n
  7.  */
  8.  
  9. #include <stdio.h>
  10.  
  11. int main(void) {
  12. // your code goes here
  13. int n=5;
  14.  
  15. for(int i=1;i<=n;i++)
  16. {
  17. for(int j=1;j<=i;j++)
  18. printf("%d",j);
  19. printf("\n");
  20. }
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 544KB
stdin
Standard input is empty
stdout
1
12
123
1234
12345