#109
Să se scrie un program care citeşte de la tastatură un număr natural şi verifică dacă numărul este par sau impar.
| Problema | Paritate | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64823369 | Utilizator | |
| Fișier | paritate.cpp | Dimensiune | 183 B |
| Data încărcării | 03 Iunie 2026, 19:25 | Scor/rezultat | Eroare de compilare |
paritate.cpp: In function ‘int main()’: paritate.cpp:5:5: error: ‘longlong’ was not declared in this scope 5 | longlong n; | ^~~~~~~~ paritate.cpp:6:10: error: ‘n’ was not declared in this scope 6 | cin>>n; | ^ paritate.cpp:7:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 7 | if(n%2==0) | ^~ paritate.cpp:8:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 8 | cout<<n;" este par" | ^~~~~~~~~~~ paritate.cpp:8:24: error: expected ‘;’ before ‘else’ 8 | cout<<n;" este par" | ^ | ; 9 | else | ~~~~ paritate.cpp:8:13: warning: statement has no effect [-Wunused-value] 8 | cout<<n;" este par" | ^~~~~~~~~~~ paritate.cpp:10:25: error: expected ‘;’ before ‘return’ 10 | cout<<n;"este impar" | ^ | ; 11 | 12 | return 0; | ~~~~~~ paritate.cpp:10:13: warning: statement has no effect [-Wunused-value] 10 | cout<<n;"este impar" | ^~~~~~~~~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Paritate 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ă.