Meseriasul

Test 1

Dec 8th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void main(){
  4.     int i,n,prim = 2;
  5.     printf("n =");scanf("%d", &n);
  6.     for(i = 0; i < n; i++){
  7.         int contor = 2, ok = 1;
  8.         while(contor <= prim/2){
  9.             if(prim % contor == 0)
  10.                 ok = 0;
  11.             contor++;
  12.         }
  13.         if(ok == 1)
  14.             printf("%d ", prim);
  15.         else
  16.             n++;
  17.         prim++;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment