You are on page 1of 3

Test informatica

COMAN MADALINA XG
1. Cin>>x;
2. Cout<<a<<” ”<<b;
3. Intreg -> int a,b;
Real -> float x;
Logic -> bool ok;
4. Mod-> %
div->/
5. Modul -> abs(x)
Partea intreaga -> floor(x)
Radical -> sqrt(x)
6. Iostream
7. <> -> !=
= -> ==
<- -> =
And -> &&
Or -> ||
Not -> !
8. Acoladele { } marcheaza inceputul si sfarsitul instructiunilor care trebuie
executate.
9. #include <iostream>

using namespace std;

int main()
{
int a,b,i,s,k;
float x,y,aux;
bool ok;
cin>>a>>b>>x>>y;
s=0;
k=0;
if (x>y) {
aux=x; x=y; y=aux;
else x=x-1, y=y-0,5;
}
for ( i=floor(x),floor(y)) {
if (a>b) {
a=a-1; b=i+1; ok=false;
else k=k+1; a=a-k; b=b+k; ok=true;
}
}
while (floor(abs(b))>0) {
b=floor(abs(b));
k=k+1;
s=s+b%10;
b=b/10;
}
if {
(k>10 && ok=true) cout<<s;
else if {
((k!=0) || (ok=false) && (!(x!=y)) cout<<k;
else (s-s/k)%10;
}
}
return 0;
}

You might also like