View Code of Problem 120

#include<stdio.h>
#include<math.h>
int main(){
int h1,h2,m1,m2,s,h,m;
int a,b,count;
int i,j,flag;
while(scanf("%d:%d %d:%d",&h1,&m1,&h2,&m2)!=EOF){
count=0,s=0,m=0,h=0;
a=60*h1+m1;
b=60*h2+m2;
for(i=a;i<=b;i++){
h=i/60;
m=i%60;
s=h*2500+m;
flag=1;
for(j=2;j<=sqrt(s);j++){
	if(s%j==0){
		flag=0;
		break;}}
if(flag==1){
	count++;}

}
printf("%d\n",count);
}	
return 0;	
}

Double click to view unformatted code.


Back to problem 120