Advertisement
madidino

teza2-sub3-2

Nov 12th, 2023 (edited)
621
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int numarare(int a, int b)
  4. {int k;
  5. int crt=0;
  6.     for(int i=a;i<=b;i++)
  7.     {k=0;
  8.         for(int j=2;j<=i/2;j++)
  9.         {
  10.             if(i%j==0)
  11.             {
  12.                 k++;
  13.             }
  14.         }
  15.         if(k==1)
  16.         {
  17.             crt++;
  18.         }
  19.     }
  20.     return crt;
  21. }
  22. int main()
  23. {
  24. cout<<numarare(6,36);
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement