View Code of Problem 119

#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
bool isPrime(int n) {
	for (int i = 2; i <= sqrt(n); i++)
		if (n%i == 0)
			return 0;
	return 1;
}
int main() {
	int n,k=1;
	while (cin >> n) {
		cout << "Case #" << k++ << ": ";
		if (isPrime(n))
			cout << "I'm richer than any one" << endl;
		else
			cout << "What a fxcking day" << endl;
	}
}

Double click to view unformatted code.


Back to problem 119