Advertisement
allia

наибольший делитель

Sep 11th, 2020
1,644
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main ()
  7. {
  8.  long long a=0, res=0;
  9.  cin >> a;
  10.  
  11.  for (int i=2; i<=a/2; i++)
  12.   if (a%i==0)
  13.     {
  14.       res=i;
  15.       break;
  16.     }
  17.  
  18.  if (res==0)
  19.     cout << 1;
  20.  else cout << a/res;
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement