SHARE
TWEET

Untitled

a guest Jan 22nd, 2020 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int h,h1,x,y,r;
  5. struct fractie
  6. {
  7.     int numa,numi;
  8. }a,b;
  9. int main()
  10. {int x,y;
  11.     cin>>a.numa>>a.numi>>b.numa>>b.numi;
  12.    if(a.numa*b.numi>a.numi*b.numa)
  13.    {
  14.        x=a.numa,y=a.numi;
  15.        while(y)
  16.        {
  17.            r=x%y,x=y,y=r;
  18.        }
  19.        cout<<a.numa/x<<" "<<a.numi/x;
  20.    }
  21.    else
  22.    {x=b.numa,y=b.numi;
  23.        while(y)
  24.        {
  25.            r=x%y,x=y,y=r;
  26.        }
  27.        cout<<b.numa/x<<" "<<b.numi/x;
  28.    }
  29.  
  30.     return 0;
  31. }
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