Problem 3nplus1
User AL
Submission Time 2026-11-10 14:15:24
Score 0
Max Time N/A
Max Memory N/A

Compile Error

3nplus1.cpp: In function ‘int32_t main()’:
3nplus1.cpp:6:21: error: ‘sum’ was not declared in this scope
6 | double x; cin >> x;sum = 0;
| ^~~
3nplus1.cpp:8:7: error: invalid operands of types ‘double’ and ‘int’ to binary ‘operator%’
8 | if(x%2 == 0){//even number
| ~^~
| | |
| | int
| double
3nplus1.cpp:10:3: error: expected ‘}’ before ‘else’
10 | else if(x%2 > 0){//odd number
| ^~~~
3nplus1.cpp:8:15: note: to match this ‘{’
8 | if(x%2 == 0){//even number
| ^
3nplus1.cpp:10:12: error: invalid operands of types ‘double’ and ‘int’ to binary ‘operator%’
10 | else if(x%2 > 0){//odd number
| ~^~
| | |
| | int
| double
3nplus1.cpp:16:3: error: expected ‘}’ at end of input
16 | }
| ^
3nplus1.cpp:7:18: note: