Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int h,h1,x,y,r;
- struct fractie
- {
- int numa,numi;
- }a,b;
- int main()
- {int x,y;
- cin>>a.numa>>a.numi>>b.numa>>b.numi;
- if(a.numa*b.numi>a.numi*b.numa)
- {
- x=a.numa,y=a.numi;
- while(y)
- {
- r=x%y,x=y,y=r;
- }
- cout<<a.numa/x<<" "<<a.numi/x;
- }
- else
- {x=b.numa,y=b.numi;
- while(y)
- {
- r=x%y,x=y,y=r;
- }
- cout<<b.numa/x<<" "<<b.numi/x;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement