Problem nprime
User AltheaZ
Submission Time 2023-06-30 09:44:44
Score 0
Max Time N/A
Max Memory N/A

Compile Error

nprime.cpp: In function ‘bool isPrime(int)’:
nprime.cpp:9:3: error: expected ‘}’ before ‘else’
9 | else{
| ^~~~
nprime.cpp:7:14: note: to match this ‘{’
7 | if (x%i==0){
| ^
nprime.cpp:12:11: error: a function-definition is not allowed here before ‘{’ token
12 | int main(){
| ^
nprime.cpp:28:1: error: expected ‘}’ at end of input
28 | }
| ^
nprime.cpp:9:7: note: to match this ‘{’
9 | else{
| ^
nprime.cpp:28:1: error: expected ‘}’ at end of input
28 | }
| ^
nprime.cpp:6:29: note: to match this ‘{’
6 | for (int i=2;i<sqrt(x);i++){
| ^
nprime.cpp:28:1: error: expected ‘}’ at end of input
28 | }
| ^
nprime.cpp:5:20: note: to match this ‘{’
5 | bool isPrime(int x){
| ^