#4897
Un număr se numește palindrom dacă prima lui cifră este egală cu ultima, a doua cu penultima și așa mai departe. De exemplu numerele 1221, 505 și 7 sunt palindromuri, în vreme ce 500, 1410 și 2424 nu sunt palindromuri.
Se citește de la tastatură un număr natural n cu cel mult 4 cifre. Să se verifice dacă numărul citit este un palindrom.
| Problema | Pal1234 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64107893 | Utilizator | |
| Fișier | pal1234.cpp | Dimensiune | 632 B |
| Data încărcării | 17 Aprilie 2026, 11:52 | Scor/rezultat | Eroare de compilare |
pal1234.cpp: In function ‘int main()’: pal1234.cpp:10:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 10 | if (n >= 10) | ^~ pal1234.cpp:12:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 12 | b = n % 10; | ^ pal1234.cpp:17:5: error: ‘else’ without a previous ‘if’ 17 | else | ^~~~ pal1234.cpp:18:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 18 | if (n >= 100) | ^~ pal1234.cpp:20:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 20 | b = n % 10; | ^ pal1234.cpp:22:23: error: expected ‘;’ before ‘else’ 22 | cout << "DA" | ^ | ; 23 | else | ~~~~ pal1234.cpp:26:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 26 | if (n >= 100 && n <= 999) | ^~ pal1234.cpp:28:11: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 28 | b = n % 10; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Pal1234 face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.