#115
Să se scrie un program care citeşte de la tastatură un şir de numere naturale şi determină media aritmetică a celor pare.
| Problema | medie | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64571965 | Utilizator | |
| Fișier | medie.cpp | Dimensiune | 327 B |
| Data încărcării | 15 Mai 2026, 08:34 | Scor/rezultat | Eroare de compilare |
medie.cpp: In function ‘int main()’: medie.cpp:10:4: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 10 | for(i=1; i<=z; i++) | ^~~ medie.cpp:12:8: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 12 | if(x%2==0) | ^~ medie.cpp:13:11: error: ‘s’ was not declared in this scope 13 | {S=s+x;}} | ^ medie.cpp:7:15: warning: unused variable ‘M’ [-Wunused-variable] 7 | double K, M; | ^ medie.cpp: At global scope: medie.cpp:14:1: error: ‘M’ does not name a type 14 | M=S/z; | ^ medie.cpp:15:1: error: ‘cout’ does not name a type 15 | cout<<fixed<<setprecision(2)<< M; | ^~~~ medie.cpp:16:5: error: expected unqualified-id before ‘return’ 16 | return 0; | ^~~~~~ medie.cpp:17:1: error: expected declaration before ‘}’ token 17 | } | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema medie 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ă.