Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream f ("numere.in");
  5. ofstream g("numere.out");
  6. int cmmc (int x,int y)
  7. {
  8. int p;
  9. p=x*y;
  10. while (x!=y)
  11. {
  12. if (x>y)
  13. x=x-y;
  14. else
  15. y=y-x;
  16. }
  17. return p/x;
  18. }
  19. int main()
  20. {
  21. int k,x,y,i;
  22. f>>k;
  23. while(f>>x)
  24. {
  25. f>>y;
  26. g<<cmmc(x,y)<<endl;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement