#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 | #64320965 | Utilizator | |
| Fișier | paritate.cpp | Dimensiune | 188 B |
| Data încărcării | 29 Aprilie 2026, 14:57 | Scor/rezultat | Eroare de compilare |
paritate.cpp: In function ‘int main()’: paritate.cpp:6:5: error: ‘cin’ was not declared in this scope 6 | cin>>x; | ^~~ paritate.cpp:1:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? +++ |+#include <iostream> 1 | //#include <iostream> paritate.cpp:8:6: error: ‘cout’ was not declared in this scope 8 | cout<<n<<" este par"; | ^~~~ paritate.cpp:8:6: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? paritate.cpp:8:12: error: ‘n’ was not declared in this scope 8 | cout<<n<<" este par"; | ^ paritate.cpp:10:5: error: ‘cout’ was not declared in this scope 10 | cout<<n<<" este impar"; | ^~~~ paritate.cpp:10:5: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? paritate.cpp:10:11: error: ‘n’ was not declared in this scope 10 | cout<<n<<" este impar"; | ^ paritate.cpp:9:1: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation] 9 | else | ^~~~ paritate.cpp:11:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’ 11 | returm 0; | ^~~~~~ paritate.cpp:11:5: error: ‘returm’ was not declared in this scope
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ă.