View Code of Problem 119

#include<stdio.h>
#include<math.h>
int isprim(int x){
	int i,f=0;
	if(x==1||x==2||x==3){
		return 1;
	}
	for(i=2;i<=sqrt(x);i++){
		if(x%i==0){
			return 0;
		}		
	}
	return 1;
}
int main(){
	int k=0;
	long long T;
	while(scanf("%lld",&T)!=EOF){
		k++;
		if(isprim(T)==1){
			printf("Case #%d: I'm richer than any one\n",k);
		}else{
			printf("Case #%d: What a fxcking day\n",k);
		}
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 119