Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <conio.h>
- #define N 1000000000
- int main()
- {
- FILE *f;
- int szam, oszto;
- f=fopen("e:\\prim.txt","w+t");
- if (f==NULL)
- {
- printf("Nincs meg a hiba fájl!");
- return 1;
- }
- for (szam=500000000;szam<N;szam++)
- {
- oszto=2;
- while (oszto<=sqrt(szam) && (szam % oszto !=0))
- oszto++;
- if (oszto>sqrt(szam))
- {
- fprintf(f,"%d, ",szam);
- printf("%d",szam);
- }
- }
- fclose(f);
- printf("\a");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment