View Code of Problem 118

#include<stdio.h>
int main()
{
	int n;
	int count = 1;
	while (scanf("%d",&n)!=EOF)
	{
		printf("Case #%d: ", count++);
		if (n <= 3) printf("5\n");
		else
		{
			float m = 5;
			for (int i = 1; i <= n-3; i++)
			{
				m = m + 1.5;
			}
			if ((n - 3) % 2 == 0)
				printf("%.0f\n", m);
			else
				printf("%.0f\n", m + 0.5);
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 118