#2949
medie_armonica
Se dau n
numere naturale. Calculați media armonică a celor n
numere citite cu 2
zecimale exacte.
Problema | medie_armonica | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #51296698 | Utilizator | |
Fișier | medie_armonica.c | Dimensiune | 329 B |
Data încărcării | 05 Iunie 2024, 02:32 | Scor / rezultat | Eroare de compilare |
medie_armonica.c: In function 'main': medie_armonica.c:5:1: warning: too many arguments for format [-Wformat-extra-args] scanf ("glf", &n); ^ medie_armonica.c:8:3: error: lvalue required as left operand of assignment 5 += 1/x; ^ medie_armonica.c:9:7: error: 'S' undeclared (first use in this function) 5 = n/S; ^ medie_armonica.c:9:7: note: each undeclared identifier is reported only once for each function it appears in medie_armonica.c:12:1: error: 'II' undeclared (first use in this function) II|#816 ^ medie_armonica.c:12:4: error: stray '#' in program II|#816 ^ medie_armonica.c:13:20: warning: extra tokens at end of #include directive [enabled by default] #include <stdio.h> int main () 1 ^ medie_armonica.c:14:1: error: expected ';' before 'int' int x, y, n = 0; ^ medie_armonica.c:15:1: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'double *' [-Wformat=] scanf("%d", &x); ^ medie_armonica.c:16:15: error: 'y' undeclared (first use in this function) scanf ("%d", &y); ^ medie_armonica.c:19:1: warning: format '%d' expects argument of type 'int', but argument 2 has type 'double' [-Wformat=] printf("%d", n); ^ medie_armonica.c:20:1: error: expected declaration or statement at end of input return 0; ^ medie_armonica.c:20:1: error: expected declaration or statement at end of input medie_armonica.c:5:7: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result] scanf ("glf", &n); ^ medie_armonica.c:7:6: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result] scanf("%lf", &x); ^ medie_armonica.c:15:6: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &x); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema medie_armonica 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ă.