View Code of Problem 118

#include<stdio.h>
int main(){
	long n,i,k=1;
	float sum=0.0;
	while(scanf("%d",&n)!=EOF){
		if(n<=3)
			sum=5.0;
		else if(n%2!=0)
			sum=(n-3)*1.5+5.0;
		else
			sum=(n-3)*1.5+5.5;
		printf("Case #%d: %.0f\n",k++,sum);
	}
}

Double click to view unformatted code.


Back to problem 118