Răspuns :
#include <iostream>
using namespace std;
int main()
{
int mare,mic,x;
cout <<"x= ";cin >>x;
mare=x;
mic=x;
while (x!=0)
{
cout <<"x= ";cin >>x;
if (mare<x)
mare=x;
if (mic>x)
mic=x;
}
while (mic!=mare)
{
if (mic>mare)
mic=mic-mare;
else
mare=mare-mic;
}
cout <<"cmmdc= "<<mare;
return 0;
}
using namespace std;
int main()
{
int mare,mic,x;
cout <<"x= ";cin >>x;
mare=x;
mic=x;
while (x!=0)
{
cout <<"x= ";cin >>x;
if (mare<x)
mare=x;
if (mic>x)
mic=x;
}
while (mic!=mare)
{
if (mic>mare)
mic=mic-mare;
else
mare=mare-mic;
}
cout <<"cmmdc= "<<mare;
return 0;
}