#109
Paritate
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 | #41670020 | Utilizator | |
Fișier | paritate.cpp | Dimensiune | 177 B |
Data încărcării | 31 Ianuarie 2023, 19:22 | Scor / rezultat | Eroare de compilare |
paritate.cpp:2:7: error: expected nested-name-specifier before 'namspace' using namspace std; ^ paritate.cpp:2:7: error: 'namspace' has not been declared paritate.cpp:2:16: error: expected ';' before 'std' using namspace std; ^ paritate.cpp:2:16: error: 'std' does not name a type paritate.cpp: In function 'int main()': paritate.cpp:7:9: error: expected ')' before 'mod' if (n mod 2=1) ^ paritate.cpp:8:3: error: 'cout' was not declared in this scope cout << n >> "este impar"; ^ paritate.cpp:8:3: 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:9:9: error: expected ')' before 'mod' if (n mod 2=0) ^ paritate.cpp:10:3: error: 'cout' was not declared in this scope cout << n >> "este par"; ^ paritate.cpp:10:3: 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:11: error: expected '}' at end of input return 0; ^
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ă.