daily pastebin goal
66%
SHARE
TWEET

задача 12

AlsuSitdikova Dec 16th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. double nod(int a,int b){
  5.     int max;int p;
  6.     if(a>b){
  7.     max=a;  
  8.     }
  9.     else{ max=b;
  10.     }
  11.     for(int i=max;i>=1;--i){
  12.         if(((a%i)==0)&&((b%i)==0)){
  13.             p=i;break;
  14.         }
  15.         }
  16.         return p;
  17.     }
  18. int main(){
  19.     int a,b; cin>>a>>b;
  20.     double k=nod(a,b);
  21.     cout<<k;
  22. }
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