View Code of Problem 119

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

Double click to view unformatted code.


Back to problem 119