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