#1902: 到 line 10 就 WA


elct9620 (弦夜)


以下為程式碼:

#include<iostream>
#include<math.h>

using namespace std;

int check(int num){
  if(num%2 == 0 && num != 2) return true;
  int i,run;
  run = ceil(sqrt(num));
  for(i = 3;i <= run;i+=2){
    if(num%i == 0) return true;
    return false;
  }
}

int main(){
  int a;
  while(cin >> a){
    if(check(a)){
      cout << "非質數" << endl;
    }else{
      cout << "質數" << endl;
    }
  }
}

各位可以幫我判斷一下問題在哪裡嗎?
(我腦袋快受不了了~~)