View Code of Problem 119

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int IsPrime(int n)
{
    int i;
    for(i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            return 0;
        }
    }
    return 1;
}
int main()
{
    int N,i=1;
    while(scanf("%d",&N)!=EOF)
    {

     if(IsPrime(N)==1)
     {
         printf("Case #%d: I'm richer than any one\n",i);
     }
     else
     {
        printf("Case #%d: What a fxcking day\n",i);
     }
        i++;
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 119