#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 | #64645781 | Utilizator | |
| Fișier | medie.cpp | Dimensiune | 330 B |
| Data încărcării | 20 Mai 2026, 11:19 | Scor/rezultat | Eroare de compilare |
medie.cpp: In function ‘int main()’: medie.cpp:6:5: error: expected unqualified-id before ‘int’ 6 | int count=0,s=0; | ^~~ medie.cpp:13:13: error: ‘s’ was not declared in this scope 13 | s+=x; | ^ medie.cpp:14:13: error: ‘count’ was not declared in this scope 14 | count++; | ^~~~~ medie.cpp:17:8: error: ‘count’ was not declared in this scope 17 | if(count!=0); | ^~~~~ medie.cpp:17:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 17 | if(count!=0); | ^~ medie.cpp:18:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 18 | cout<<(double)s/count; | ^~~~ medie.cpp:18:23: error: ‘s’ was not declared in this scope 18 | cout<<(double)s/count; | ^ medie.cpp:18:25: error: ‘count’ was not declared in this scope 18 | cout<<(double)s/count; | ^~~~~
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ă.