View Code of Problem 119

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

Double click to view unformatted code.


Back to problem 119