Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int main()
  5. {
  6.     int a=0;
  7.     int b=0;
  8.  
  9.     cin>>a>>b;
  10.     int c=a;
  11.     int d=b;
  12.     while(a!=b)
  13.     {
  14.         if(a>b) a=a-b;
  15.         else b=b-a;
  16.  
  17.     }
  18.     cout<<a<<endl; //nwd
  19.     cout<<(c*d)/a; //nww
  20.  
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement