Răspuns :
Răspuns:
a)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x,y,z;
cin>>x>>y>>z;
while(y!=0)
{
int r=x%y;
x=y;
y=r;
}
while(z!=0)
{
int r=x%z;
x=z;
z=r;
}
cout<<x;
return 0;
}
b)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x,y,z,a,b,c;
cin>>x>>y>>z;
a=x;
b=y;
c=z;
while(y!=0)
{
int r=x%y;
x=y;
y=r;
}
int h=(a*b)/x;
while(z!=0)
{
int r=x%z;
x=z;
z=r;
}
cout<<(h*c)/x;
return 0;
}
c)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x,y,z,maxx;
cin>>x>>y>>z;
maxx=x;
if(y>x)
{
maxx=y;
if(z>y)
maxx=z;
}
else if(z>x)
{
maxx=z;
if(y>z)
maxx=y;
}
cout<<maxx;
return 0;
}
d)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x,y,z,minn;
cin>>x>>y>>z;
minn=x;
if(y<x)
{
minn=y;
if(z<y)
minn=z;
}
else if(z<x)
{
minn=z;
if(y<z)
minn=y;
}
cout<<minn;
return 0;
}
e)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x,y,z,maxx;
cin>>x>>y>>z;
maxx=x;
if(y>x)
{
maxx=y;
if(z>y)
maxx=z;
}
else if(z>x)
{
maxx=z;
if(y>z)
maxx=y;
}
for(int i=1;i<=maxx;i++)
if(x%i==0 and y%i==0 and z%i==0)
cout<<i<<" ";
return 0;
}
Explicație:
Sper ca te-am ajutat!!