#169
Să se scrie un program care citeşte de la tastatură un număr natural cu exact trei cifre și determină suma cifrelor sale.
| Problema | sumcif | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64545782 | Utilizator | |
| Fișier | sumcif.cpp | Dimensiune | 227 B |
| Data încărcării | 13 Mai 2026, 14:15 | Scor/rezultat | 0 puncte |
sumcif.cpp: In function ‘int main()’: sumcif.cpp:9:6: warning: statement has no effect [-Wunused-value] 9 | n>99; | ~^~~ sumcif.cpp:10:6: warning: statement has no effect [-Wunused-value] 10 | n<1000; | ~^~~~~ sumcif.cpp:12:8: warning: comparison of constant ‘10’ with boolean expression is always true [-Wbool-compare] 12 | 0<a<10; | ~~~^~~ sumcif.cpp:12:6: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses] 12 | 0<a<10; | ~^~ sumcif.cpp:12:8: warning: statement has no effect [-Wunused-value] 12 | 0<a<10; | ~~~^~~ sumcif.cpp:13:8: warning: comparison of constant ‘10’ with boolean expression is always true [-Wbool-compare] 13 | 0<b<10; | ~~~^~~ sumcif.cpp:13:6: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses] 13 | 0<b<10; | ~^~ sumcif.cpp:13:8: warning: statement has no effect [-Wunused-value] 13 | 0<b<10; | ~~~^~~ sumcif.cpp:14:8: warning: comparison of constant ‘10’ with boolean expression is always true [-Wbool-compare] 14 | 0<c<10; | ~~~^~~ sumcif.cpp:14:6: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical meaning [-Wparentheses] 14 | 0<c<10; | ~^~ sumcif.cpp:14:8: warning: statement has no effect [-Wunused-value] 14 | 0<c<10; | ~~~^~~ sumcif.cpp:11:10: warning: ‘a’ is used uninitialized [-Wuninitialized] 11 | n=100*a+10*b+1*c; | ~~~^~ sumcif.cpp:7:13: note: ‘a’ was declared here 7 | int n,s,a,b,c; | ^ sumcif.cpp:11:15: warning: ‘b’ is used uninitialized [-Wuninitialized] 11 | n=100*a+10*b+1*c; | ~~^~ sumcif.cpp:7:15: note: ‘b’ was declared here 7 | int n,s,a,b,c; | ^ sumcif.cpp:11:17: warning: ‘c’ is used uninitialized [-Wuninitialized] 11 | n=100*a+10*b+1*c; | ~~~~~~~~~~^~~~ sumcif.cpp:7:17: note: ‘c’ was declared here 7 | int n,s,a,b,c; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | Raspuns gresit. | 20 | 0 | Exemplu | |
| 2 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 3 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 4 | 0.002 secunde | Raspuns gresit. | 20 | 0 | ||
| 5 | 0.002 secunde | Raspuns gresit. | 20 | 0 | ||
| Punctaj total | 0 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sumcif 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ă.