#include<stdio.h> #include<math.h> bool prime(long long n){ if(n==1)return false; if(n==2)return true; else{ for(int i=2;i<=sqrt(n);i++){ if(n%i==0){ return false; break; } } } return true; } int main(){ int k; long long n; k=0; while(scanf("%lld",&n)!=EOF){ k++; if(prime(n))printf("Case #%d:I'm richer than any one\n",k); else printf("Case #%d:What a fxcking day\n",k); } } /* Main.c:3:1: error: unknown type name 'bool' bool prime(long long n){ ^ Main.c: In function 'prime': Main.c:4:17: error: 'false' undeclared (first use in this function) if(n==1)return false; ^ Main.c:4:17: note: each undeclared identifier is reported only once for each function it appears in Main.c:5:17: error: 'true' undeclared (first use in this function) if(n==2)return true; ^ Main.c:15:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ */ |
Double click to view unformatted code.