borsha06

80A

Dec 20th, 2017
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int n,i,j,k,l,c;
  6.     cin>>n>>k;
  7. n++;
  8.     while(n<=k)
  9.     {
  10.  
  11.         cout<<"n"<<n<<endl;
  12.         c=0;
  13.         for(i=2; i<n; i++)
  14.         {
  15.             if((n%i) == 0)
  16.             {
  17.                 cout<<"n"<<n<<" "<<"i"<<i<<endl;
  18.                 c++;
  19.                 cout<<"c"<<" "<<c<<endl;
  20.                 break;
  21.  
  22.  
  23.             }
  24.         }
  25.         if(c==0)
  26.         {
  27.             break;
  28.         }
  29.         else
  30.         {
  31.             n++;
  32.             cout<<"n++"<<n<<endl;
  33.         }
  34.  
  35.     }
  36.     if(n==k)
  37.     {
  38.         cout<<"n"<<n<<endl;
  39.         cout<<"YES"<<endl;
  40.     }
  41.     else
  42.         cout<<"NO"<<endl;
  43.     return 0;
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment