Professional Documents
Culture Documents
Test Informatica - 16 Noiembrie
Test Informatica - 16 Noiembrie
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;
c1=n/100;
c2=n/10%10;
c3=n%10;
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;
}