Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
4471 李宇轩 素数判断 C++ Compile Error 0 MS 0 KB 289 2024-08-20 18:10:38

Tests(0/0):


Code:

# include<iostream> using namespace std; int main() { int n,w=0,i=2,r; scanf("%d",&n); while(n>=3&&n<=1000){ if(n/i==0){ w=1; }else{ i++; } if(i>sqrt(n)||w!=0){ if(w==0){ printf("prime") ;break; }else{ printf("not prime");break;} } } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:13:13: error: 'sqrt' was not declared in this scope
  if(i>sqrt(n)||w!=0){ 
             ^
Main.cc:5:16: warning: unused variable 'r' [-Wunused-variable]
  int n,w=0,i=2,r;
                ^