Alx09

Untitled

May 7th, 2020
989
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4.  
  5.  
  6. int main(void) {
  7.     unsigned n, i = 0, v[] = { 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, 97, 113, 131, 197, 199, 311, 337, 373, 719, 733, 919, 971, 991, 1193, 1931, 3119, 3779, 7793, 7937, 9311, 9377, 10002 };
  8.     FILE *f;
  9.     f = fopen("in.txt", "r");
  10.     fscanf(f, "%u", &n);
  11.     fclose(f);
  12.     f = fopen("out.txt", "w");
  13.     while(v[i] < n)
  14.         fprintf(f, "%d ",v[i++]);
  15.     system("pause");
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment