Advertisement
SelinD

V84s3e4.cpp

Mar 12th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. using namespace std;
  4. ifstream fin("numere1.in.cpp");
  5.  
  6. int cmmmc(int x,int y)
  7. {
  8. int p,r;
  9. p=x*y;
  10. while(y!=0)
  11. {
  12. r=x%y;
  13. x=y;
  14. y=r;
  15. }
  16. return p/x;
  17. }
  18.  
  19. int main()
  20. {
  21. int x,y;
  22. while(fin>>x>>y)
  23. {
  24. cout<<cmmmc(x,y)<<endl;
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement