View Code of Problem 118

#include<stdio.h>
#include<math.h>
main()
{
	int n,k=1;
	int price;
	while(scanf("%d",&n)!=EOF)
	{
		if(n<=3)
		{
			price=5;
			printf("Case #%d: %d\n",k,price);
			k++;
		}
		else
		{
			price=5+ceil((n-3)*1.5);
			printf("Case #%d: %d\n",k,price);
			k++;
		}
	}
}

Double click to view unformatted code.


Back to problem 118