👤

Transformati din algoritm in structura CODE BLOCKS:

citeste x(numar natural)
aux←x
ok1←1
cat timp x≥10 executa
daca x%10>[x/10]%10 atunci
ok1←0

x←[x/10]

daca ok1=1 atunci
scrie aux
altfel scrie "nu"


Răspuns :

cin>>x;
aux=x;
ok1=1;
while (x>=10){
    if (x%10>(x/10)%10) ok1=0;
}
x=x/10;
if (ok1=1) cout<<aux;
else cout<<"nu";