Advertisement
ebx

PrBrDoN

ebx
May 3rd, 2011
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main(int argc, char **argv)
  4. {
  5.     int n,i,j,p=0,k=1;
  6.     scanf("%d", &n);
  7.     for (i=1; k<=n; i+=2) {
  8.     for (j=3; j<=sqrt(i); j+=2)
  9.     if (i%j==0 || i%2==0) p=1;
  10.     if (p==0) {
  11.     printf("%d\n", i);
  12.         k++;
  13.     }
  14.     p=0;
  15. }
  16.        
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement