View Code of Problem 118

#include<stdio.h>
int main()
{
	int m,i,j,k,n,sum=0;
	while(scanf("%d",&n)!=EOF)
	{
		double money=5;
		sum++;
		if(n>3)
		{
			money+=(n-3)*1.5;
		}
		if((int)money!=money)
		{
			printf("Case #%d: %d\n",sum,(int)money+1);
		}
		else
		{
			printf("Case #%d: %d\n",sum,(int)money);
		}
	}
}

Double click to view unformatted code.


Back to problem 118