#12595: line519測資沒過


james0452000 (Falcon)


各位好

請問我的code哪裡有問題?? 正解是40但是我答案是1

是測資a>b嗎??

程式碼如下

http://ideone.com/jiSi4w

#include <stdio.h>
#include <math.h>
int a,b;
int j,i;
int count,is;

int main(void) {
while(scanf("%d %d",&a,&b)!=EOF){
count = 0;
if(a>b){
printf("0\n");
}
for(i=a;i<=b;i++){
if(i%2==0){
continue;
}
is = 0;
for(j=2;j<=sqrt(i);j++){
if(i%j==0){
is = 1;
break;
}
}
if(is==0){
count = count +1;
}
}
printf("%d\n",count);
}
return 0;
}