Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main(int argc, char **argv)
- {
- int n,i,j,p=0,k=1;
- scanf("%d", &n);
- for (i=1; k<=n; i+=2) {
- for (j=3; j<=sqrt(i); j+=2)
- if (i%j==0 || i%2==0) p=1;
- if (p==0) {
- printf("%d\n", i);
- k++;
- }
- p=0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement