Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
106603 华雅萱 判断质数(使用while循环) C++ Compile Error 0 MS 0 KB 302 2025-01-16 14:01:32

Tests(0/0):


Code:

#include<iostream> using namespace std; int main(){ int n; cin>>n; bool a=1; for(int i=2;i<=sqrt(n);i++){ if(n%i==0){ a=0; break; } } if(a==1){ cout<<"Yes"; } else{ cout<<"No"; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:26: error: 'sqrt' was not declared in this scope
     for(int i=2;i<=sqrt(n);i++){
                          ^