#include <iostream >
using namespace std;
int cmmdc(int a, int b)
{
int r;
r=a%b;
while(r!=0)
{
a=b;
b=r;
r=a%b;
}
return b;
}
int cmmmc(int a, int b)
{
return(a*b/cmmdc(a,b));
}
int main(void)
{
int x,y,d,m;
cout<<"Dati primul numar ";cin>>x;
cout<<"Dati al doilea numar ";cin>>y;
d=cmmdc(x,y);
cout<<"C.m.m.d.c este "<<d<<endl;
m=cmmmc(x,y);
cout<<"C.m.m.m.c este "<<m<<endl;
}
Niciun comentariu:
Trimiteți un comentariu