View Code of Problem 118

#include "stdio.h"
#include "string.h"

void main()
{	
	int i;
	int n;
	double money;
	for(i=1;scanf("%d",&n)!=EOF;i++)
	{
		if(n<=3)
			money=5;
		else
			money=5+(n-3)*1.5;
		if(money-(int)money!=0)
			printf("Case #%d: %d\n",i,(int)money+1);
		else
			printf("Case #%d: %.0lf\n",i,money);
	}
}

Double click to view unformatted code.


Back to problem 118