View Code of Problem 118

#include <stdio.h>
main(){
	int n,k =1;
	while(scanf("%d",&n)!=EOF){
		if(n == 0)
			break;

		if(n<=3){
			printf("Case #%d: 5\n",k);
			k++;
		}
		else{
			int sum1;
			float sum = 5;
			while(n-3>0){
				sum+=1.5;
				n--;
			}
			sum1 = (int)sum;
			if(sum-sum1>=0.5)
				sum1++;
			printf("Case #%d: %d\n",k,sum1);
			k++;
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 118