Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
homework
// Example program #include <iostream> using namespace std; struct Dr{ int up; int down; }; Dr sokr(Dr dr){ int up = dr.up, down = dr.down; if((up % down) == 0){ up = up / down; down = 1; } else { int x = up, y = down; bool b = true; while(x!=y && b){ if(x>y){ x = x-y; } else { y = y-x; } if(x<=0 || y<=0){ b = false; } } if(b){ up = up / x; down = down / y; } } dr.up = up; dr.down = down; return dr; } int main(){ Dr dr; int x,y; cin >> x >> y; dr.up = x; dr.down = y; dr = sokr(dr); cout<< dr.up << '/' << dr.down; }
run
|
edit
|
history
|
help
0
FindMissingLagrange
MeanSDVar
UB mutex lock
role of destructor during DMA
TraiectorieIdeala2
enums
Boost phoenix e.g. 1 no functor
27
Hello world!
Stream5