Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3.  
  4. bool licz_p(x)
  5. {
  6.     if ((x==0) || (x==1) || (x==2))
  7.     {
  8.         return false;
  9.     }
  10.         int i;
  11.         for (i=2; i<x; i++)
  12.         {
  13.             if (x%i==0)
  14.             return true;
  15.         }
  16.         return false;
  17. }
  18.  
  19. main()
  20. {
  21.     int i,j,n=0;
  22.    
  23.     printf("Ile liczb?: ");
  24.     scanf("%d",n);
  25.     while (i<n)
  26.     {
  27.         if (licz_p(j))
  28.         {
  29.             i++;
  30.             printf("%d",j);
  31.         }
  32.         j++;
  33.     }  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement