View Code of Problem 118

#include <stdio.h>
#include <stdlib.h>
#include<ctype.h>
#include<string.h>
#include<math.h>

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

Double click to view unformatted code.


Back to problem 118