Advertisement
Dani_info

cmmmc var 2

Dec 7th, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int a, b, p, r, cmmdc;
  8.     //cmmmc[x,y]=(x*y)/cmmdc(x,y)
  9.     cout<<"a="; cin>>a;
  10.     cout<<"b="; cin>>b;
  11.     p=a*b;
  12.     if(a==0 || b==0)
  13.         cout<<"Cmmmc=0";
  14.     else
  15.     {
  16.         do
  17.         {
  18.             r=a%b;
  19.             a=b;
  20.             b=r;
  21.         }
  22.         while(r);
  23.         cmmdc=a;
  24.     }
  25.     int cmmmc=p/cmmdc;
  26.     cout<<"CMMMC este:"<<cmmmc;
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement