You are on page 1of 2

Problema 1.

int main()
{
int h, m, x;
cin >> h >> m >> x;
h = h + ((x + m) / 60);
m = (m + x) - (((x + m) / 60) * 60);
if (h > 23)
h = h - 24 * (h / 24);
cout << h << ' ' << m << endl;
return 0;
}

Problema 2.

int n,c1,c2,c3,s;

int main()

{cout<<"Numărul n este:";

cin>>n;

if(n<=101 || n>=988) cout<<"Numărul nu corespunde cerinței.";

c1=n/100;

c2=n/10%10;

c3=n%10;

if(c1==c2 || c1==c3 || c2==c3) cout<<"Numărul nu corespunde cerinței.";

s=c1*100+c2*10+c3+c2*100+c1*10+c3+c2*100+c3*10+c1+c1*100+c3*10+c2+c3*100+c2*10+c1+c
3*100+c1*10+c2;

cout<<s;

return 0;

Problema 3.

int main()
{
int n;
cin >> n;
if(n == 0){
cout << 1;
return 0;
}
if(n % 2 == 0)
cout << 1;
else
cout << 4;
return 0;
}

Problema 4.

int main()
{
int n;
cin >> n;
if (n % 3 == 0){
cout << (n/3)-1 << ' ' << n/3 << ' ' << (n/3)+1;
}
else {
cout << "NU EXISTA";
}
return 0;
}

You might also like