#include <iostream>
using namespace std;
int n,a,s,dv;
int main()
{
cout << "Introduceti numarul n: ";
cin >> n;
int min = n%10;
int max = n%10;
while (n != 0)
{
a = n % 10;
if(a>max)
max=a;
if(a<min)
min=a;
n = n / 10;
}
cout << "\nNumarul maxim este: "<<max;
cout << "\nNumarul minim este: "<<min;
int m = max;
int n = min;
while(m!=n)
{
if(m>n)
m=m-n;
else
n=n-m;
}
cout << "\nCel mai mare divizorcomun este: "<<m;
return 0;
}