Advertisement
Bisus

Untitled

Oct 22nd, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(int argc, const char *argv[])
  5. {
  6.     FILE *output;
  7.     int i;
  8.  
  9.     if(argc!=3)
  10.     {
  11.         fprintf(stderr, "Usage: %s name_of_output_file amount_of_elements\n", argv[0]);
  12.         return -1;
  13.     }
  14.  
  15.     output = fopen(argv[1], "w");
  16.  
  17.     for(i = 0; i<atoi(argv[2]); i++)
  18.     {
  19.         fprintf(output, "%d\n", rand());
  20.     }
  21.  
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement