Advertisement
STANAANDREY

sumadiv

Nov 15th, 2018
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8.   unsigned n,nr=0,x=1;
  9.   cout<<"n=";cin>>n;
  10.  
  11.  while (nr!=n) {
  12.     if ((2*x+1)%n==0)
  13.  {
  14.      cout<<x<<" "<<x+1<<endl;
  15.      nr++;
  16.  }
  17.  
  18.   x++;}
  19.  
  20. return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement