View Code of Problem 119

# include<stdio.h>
# include<stdbool.h>
# include<math.h>
bool isPrime(int n){
  	bool flag=1;
  	if(n<=1){
  		flag=0;
	  }
  	for(int i=2;i<=sqrt(n);i++){
  		if(n%i==0){
  			flag=0;
  			break;
		  }
	  }
	  return flag;
}
int main(){
	int N,count=0;
	while(scanf("%d",&N)!=EOF){
		count++;
		if(isPrime(N)){
			printf("Case #%d: I'm richer than any one\n",count);
		}
		else{
			printf("Case #%d:  What a fxcking day\n",count);
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 119