#16
Suma divizorilor
C++
Să se scrie o funcție C++ care să determine suma divizorilor unui număr natural transmis ca parametru. Funcția va returna rezultatul.
Problema | Suma divizorilor | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #13799880 | Utilizator | |
Fișier | suma_divizorilor.cpp | Dimensiune | 200 B |
Data încărcării | 10 Februarie 2019, 14:39 | Scor / rezultat | Eroare de compilare |
suma_divizorilor.cpp:5:1: error: stray '\302' in program int s = 0, i; ^ suma_divizorilor.cpp:5:1: error: stray '\240' in program suma_divizorilor.cpp:5:1: error: stray '\302' in program suma_divizorilor.cpp:5:1: error: stray '\240' in program suma_divizorilor.cpp:5:1: error: stray '\302' in program suma_divizorilor.cpp:5:1: error: stray '\240' in program suma_divizorilor.cpp:6:1: error: stray '\302' in program for (i = 1; i * i < n; i++) ^ suma_divizorilor.cpp:6:1: error: stray '\240' in program suma_divizorilor.cpp:6:1: error: stray '\302' in program suma_divizorilor.cpp:6:1: error: stray '\240' in program suma_divizorilor.cpp:6:1: error: stray '\302' in program suma_divizorilor.cpp:6:1: error: stray '\240' in program suma_divizorilor.cpp:7:1: error: stray '\302' in program if (n % i == 0) ^ suma_divizorilor.cpp:7:1: error: stray '\240' in program suma_divizorilor.cpp:7:1: error: stray '\302' in program suma_divizorilor.cpp:7:1: error: stray '\240' in program suma_divizorilor.cpp:7:1: error: stray '\302' in program suma_divizorilor.cpp:7:1: error: stray '\240' in program suma_divizorilor.cpp:7:1: error: stray '\302' in program suma_divizorilor.cpp:7:1: error: stray '\240' in program suma_divizorilor.cpp:7:1: error: stray '\302' in program suma_divizorilor.cpp:7:1: error: stray '\240' in program suma_divizorilor.cpp:7:1: error: stray '\302' in program suma_divizorilor.cpp:7:1: error: stray '\240' in program suma_divizorilor.cpp:7:1: error: stray '\302' in program suma_divizorilor.cpp:7:1: error: stray '\240' in program suma_divizorilor.cpp:8:1: error: stray '\302' in program s += i + (n / i); ^ suma_divizorilor.cpp:8:1: error: stray '\240' in program suma_divizorilor.cpp:8:1: error: stray '\302' in program suma_divizorilor.cpp:8:1: error: stray '\240' in program suma_divizorilor.cpp:8:1: error: stray '\302' in program suma_divizorilor.cpp:8:1: error: stray '\240' in program suma_divizorilor.cpp:8:1: error: stray '\302' in program suma_divizorilor.cpp:8:1: error: stray '\240' in program suma_divizorilor.cpp:8:1: error: stray '\302' in program suma_divizorilor.cpp:8:1: error: stray '\240' in program suma_divizorilor.cpp:8:1: error: stray '\302' in program suma_divizorilor.cpp:8:1: error: stray '\240' in program suma_divizorilor.cpp:8:1: error: stray '\302' in program suma_divizorilor.cpp:8:1: error: stray '\240' in program suma_divizorilor.cpp:8:1: error: stray '\302' in program suma_divizorilor.cpp:8:1: error: stray '\240' in program suma_divizorilor.cpp:8:1: error: stray '\302' in program suma_divizorilor.cpp:8:1: error: stray '\240' in program suma_divizorilor.cpp:8:1: error: stray '\302' in program suma_divizorilor.cpp:8:1: error: stray '\240' in program suma_divizorilor.cpp:8:1: error: stray '\302' in program suma_divizorilor.cpp:8:1: error: stray '\240' in program suma_divizorilor.cpp:9:1: error: stray '\302' in program if (i * i == n) ^ suma_divizorilor.cpp:9:1: error: stray '\240' in program suma_divizorilor.cpp:9:1: error: stray '\302' in program suma_divizorilor.cpp:9:1: error: stray '\240' in program suma_divizorilor.cpp:9:1: error: stray '\302' in program suma_divizorilor.cpp:9:1: error: stray '\240' in program suma_divizorilor.cpp:10:1: error: stray '\302' in program s += i; ^ suma_divizorilor.cpp:10:1: error: stray '\240' in program suma_divizorilor.cpp:10:1: error: stray '\302' in program suma_divizorilor.cpp:10:1: error: stray '\240' in program suma_divizorilor.cpp:10:1: error: stray '\302' in program suma_divizorilor.cpp:10:1: error: stray '\240' in program suma_divizorilor.cpp:10:1: error: stray '\302' in program suma_divizorilor.cpp:10:1: error: stray '\240' in program suma_divizorilor.cpp:10:1: error: stray '\302' in program suma_divizorilor.cpp:10:1: error: stray '\240' in program suma_divizorilor.cpp:10:1: error: stray '\302' in program suma_divizorilor.cpp:10:1: error: stray '\240' in program suma_divizorilor.cpp:10:1: error: stray '\302' in program suma_divizorilor.cpp:10:1: error: stray '\240' in program suma_divizorilor.cpp:11:1: error: stray '\302' in program return s; ^ suma_divizorilor.cpp:11:1: error: stray '\240' in program suma_divizorilor.cpp:11:1: error: stray '\302' in program suma_divizorilor.cpp:11:1: error: stray '\240' in program suma_divizorilor.cpp:11:1: error: stray '\302' in program suma_divizorilor.cpp:11:1: error: stray '\240' in program suma_divizorilor.cpp:6:8: error: expected unqualified-id before 'for' for (i = 1; i * i < n; i++) ^ suma_divizorilor.cpp:6:20: error: 'i' does not name a type for (i = 1; i * i < n; i++) ^ suma_divizorilor.cpp:6:31: error: 'i' does not name a type for (i = 1; i * i < n; i++) ^ suma_divizorilor.cpp:9:8: error: expected unqualified-id before 'if' if (i * i == n) ^ suma_divizorilor.cpp:11:8: error: expected unqualified-id before 'return' return s; ^ suma_divizorilor.cpp: In function 'int main()': suma_divizorilor.cpp:17:20: error: 'sum_div' was not declared in this scope cout << sum_div(x) << endl; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Suma divizorilor face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.