Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
129346 罗安博 判断质数(使用while循环) C++ Compile Error 0 MS 0 KB 251 2025-08-24 13:52:18

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ long long n; int i=2 bool f=true; while(i<=sqrt(n)){ if(n%i==0){ f=false; } } if(f==true){ cout<<"yes"; } else{ cout<<"no"; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:6:5: error: expected ',' or ';' before 'bool'
     bool f=true;
     ^
Main.cc:9:7: error: 'f' was not declared in this scope
       f=false;
       ^
Main.cc:12:5: error: 'f' was not declared in this scope
  if(f==true){
     ^