#4907
Se dă numărul natural n. Afișați în ordine crescătoare:
1) numerele naturale cuprinse între 1 și n care sunt divizibile cu 2
2) numerele naturale cuprinse între 1 și n care sunt divizibile cu 3
3) numerele naturale cuprinse între 1 și n care sunt divizibile fie cu 2, fie cu 3, dar nu sunt divizibile cu 6.
| Problema | afisMul23 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 4 MB
/
Stivă 2 MB
|
| Id soluție | #65019253 | Utilizator | |
| Fișier | afismul23.cpp | Dimensiune | 409 B |
| Data încărcării | 16 Iulie 2026, 12:46 | Scor/rezultat | Eroare de compilare |
afismul23.cpp:2:14: error: expected ‘{’ before ‘;’ token 2 | namespace std; | ^ afismul23.cpp: In function ‘int main()’: afismul23.cpp:5:5: error: ‘cin’ was not declared in this scope; did you mean ‘std::cin’? 5 | cin>>n; | ^~~ | std::cin In file included from afismul23.cpp:1: /usr/include/c++/13/iostream:62:18: note: ‘std::cin’ declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ afismul23.cpp:6:14: warning: right operand of comma operator has no effect [-Wunused-value] 6 | for(i=1,i<=n,i++){ | ~^~~ afismul23.cpp:6:21: error: expected ‘;’ before ‘)’ token 6 | for(i=1,i<=n,i++){ | ^ | ; afismul23.cpp:9:11: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’? 9 | } cout<<""<<endl; | ^~~~ | std::cout /usr/include/c++/13/iostream:63:18: note: ‘std::cout’ declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ afismul23.cpp:9:21: error: ‘endl’ was not declared in this scope; did you mean ‘std::endl’? 9 | } cout<<""<<endl; | ^~~~ | std::endl In file included from /usr/include/c++/13/iostream:41: /usr/include/c++/13/ostream:735:5: note: ‘std::endl’ declared here 735 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ afismul23.cpp:10:9: error: expected primary-expression before ‘for’ 10 | for(j=1,j<=n,j++){ | ^~~ afismul23.cpp:9:26: error: expected ‘)’ before ‘for’ 9 | } cout<<""<<endl; | ^ | ) 10 | for(j=1,j<=n,j++){ | ~~~ afismul23.cpp:6:8: note: to match this ‘(’ 6 | for(i=1,i<=n,i++){ | ^ afismul23.cpp:10:18: warning: right operand of comma operator has no effect [-Wunused-value] 10 | for(j=1,j<=n,j++){ | ~^~~ afismul23.cpp:10:25: error: expected ‘;’ before ‘)’ token 10 | for(j=1,j<=n,j++){ | ^ | ; afismul23.cpp:14:9: error: expected primary-expression before ‘for’ 14 | for(k=1,k<=n,k++){ | ^~~ afismul23.cpp:13:25: error: expected ‘)’ before ‘for’ 13 | }cout<<""<<endl; | ^ | ) 14 | for(k=1,k<=n,k++){ | ~~~ afismul23.cpp:10:12: note: to match this ‘(’ 10 | for(j=1,j<=n,j++){ | ^ afismul23.cpp:14:18: warning: right operand of comma operator has no effect [-Wunused-value] 14 | for(k=1,k<=n,k++){ | ~^~~ afismul23.cpp:14:25: error: expected ‘;’ before ‘)’ token 14 | for(k=1,k<=n,k++){ | ^ | ; afismul23.cpp:18:5: error: expected primary-expression before ‘}’ token 18 | } | ^ afismul23.cpp:17:10: error: expected ‘;’ before ‘}’ token 17 | } | ^ | ; 18 | } | ~ afismul23.cpp:18:5: error: expected primary-expression before ‘}’ token 18 | } | ^ afismul23.cpp:17:10: error: expected ‘)’ before ‘}’ token 17 | } | ^ | ) 18 | } | ~ afismul23.cpp:14:12: note: to match this ‘(’ 14 | for(k=1,k<=n,k++){ | ^ afismul23.cpp:18:5: error: expected primary-expression before ‘}’ token 18 | } | ^ afismul23.cpp: At global scope: afismul23.cpp:19:1: error: expected declaration before ‘}’ token 19 | } | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema afisMul23 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ă.