Advertisement
Guest User

SHVP

a guest
Oct 31st, 2014
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int m, n;
  8.     cin >> m >> n;
  9.  
  10.     int result = 0;
  11. //fr****************************************
  12.     for (int i = 1; ; i++)
  13.     {
  14. //if----------------------------------------
  15.         if ((i%m == 0) && (i%n == 0)) //unless i is divisible by both m and n, won't print RES; if by both (which makes sense),     then print
  16.         {
  17.  
  18.             result = i;
  19.             break;
  20.         }
  21. //if----------------------------------------
  22.  
  23.     }
  24. //fr****************************************
  25.  
  26.     cout << result << endl;
  27.     return 0;
  28.  
  29.    
  30.  
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement