View Code of Problem 119

#include<iostream>
#include<math.h>
using namespace std;
int prime(long n){
	if(n==0)return 0;
	if(n==1)return 1;
	for(int i=2;i<=sqrt(n);i++){
		if(n%i==0)return 0;
	}
	return 1;
}
int main(){
	long n;
	int k=0;
	while(cin>>n){
		if(prime(n)==1){
			k++;
			printf("Case #%d: I'm richer than any one\n",k);
			
		}
		else{
			k++;
			printf("Case #%d: What a fxcking day\n",k);
		}
	}
}

Double click to view unformatted code.


Back to problem 119