Advertisement
Grugaloragran

Untitled

Oct 7th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. unsigned int prost (unsigned int k)
  3. {
  4.     unsigned int count, i, j, c,l;
  5.         count = 0;
  6.     for (i=2; i<=k;i++)
  7.     {
  8.         for  (j=2; j<i;j++)
  9.         {
  10.             if ((i%j) == 0) break;
  11.  
  12.         }
  13.         if (j >= i)
  14.         {
  15.             for (c = 2; c <= k; c++)
  16.             {
  17.                 for (l = 2; l < i; l++)
  18.                 {
  19.                     if ((c%l) == 0) break;
  20.  
  21.                 }
  22.                 if (l >= c && (j*l) < k) count++;
  23.             }
  24.         }
  25.        
  26.     }
  27.     return(count);
  28. }
  29. int main(void)
  30. {
  31.     unsigned int n, res;
  32.     scanf_s("%d", &n);
  33.     res = prost (n);
  34.     printf("%d", res);
  35.     return(0);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement