View Code of Problem 118

#include<stdio.h>
int main()
{
	int n;
	int count;
	double b;
	count=0;
	while(scanf("%d",&n)!=EOF)
	{
		count++;
		
		if(n<=3)
		{
		printf("Case #%d: 5\n",count);
		}
		else 
		{
			if((n-3)%2==0)
			{
				b=5+(n-3)*1.5;
				printf("Case #%d: %.0lf\n",count,b);
			}
			else
			{
				b=5+(n-3)*1.5+0.5;

				printf("Case #%d: %.0lf\n",count,b);
			}
		}
	}
}

Double click to view unformatted code.


Back to problem 118