#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 |
![]() |
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58407285 | Utilizator | |
Fișier | paritate.cpp | Dimensiune | 197 B |
Data încărcării | 02 Iunie 2025, 12:53 | Scor / rezultat | Eroare de compilare |
paritate.cpp:2:7: error: expected nested-name-specifier before 'namepace' using namepace std; ^ paritate.cpp:2:7: error: 'namepace' has not been declared paritate.cpp:2:16: error: expected ';' before 'std' using namepace std; ^ paritate.cpp:2:16: error: 'std' does not name a type paritate.cpp: In function 'int main()': paritate.cpp:5:5: error: 'cin' was not declared in this scope cin >> n; ^ paritate.cpp:5:5: note: suggested alternative: In file included from paritate.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: 'std::cin' extern istream cin; /// Linked to standard input ^ paritate.cpp:6:16: error: lvalue required as left operand of assignment if ( n % 2 = 0) { ^ paritate.cpp:7:9: error: 'cout' was not declared in this scope cout << "par"; ^ paritate.cpp:7:9: note: suggested alternative: In file included from paritate.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: 'std::cout' extern ostream cout; /// Linked to standard output ^ paritate.cpp:10:9: error: 'cout' was not declared in this scope cout << "impar" ^ paritate.cpp:10:9: note: suggested alternative: In file included from paritate.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: 'std::cout' extern ostream cout; /// Linked to standard output ^ paritate.cpp:11:5: error: expected ';' before '}' token } ^
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ă.