SHARE
TWEET

Untitled

a guest Nov 19th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int p, q, n, nrd=0, d, c=0;
  8.     cin>>p>>q;
  9.     for(n=p; n<=q; n++)
  10.     {
  11.         for (d=1; d<=n; d++)
  12.         {
  13.             if (n%d==0)
  14.                 nrd=nrd+1;
  15.         }
  16.         if (nrd==2)
  17.         {
  18.             c++;
  19.             cout<<n<<" "<<c<<endl;
  20.         }
  21.         nrd=0;
  22.     }
  23.     return 0;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top