fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void) {
  5. int n,i;
  6. int *a;
  7. scanf("%d",&n);
  8. a=(int *)malloc(sizeof(int)*n);
  9. for(i=0; i<n; i++){
  10. a[i]=i+1;
  11. printf("%d ",a[i]);
  12. }
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0.01s 5288KB
stdin
4
stdout
1 2 3 4