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{
			double sum = 5;
			while(n-3>0){
				sum+=1.5;
				n--;
			}
			printf("Case #%d: %.0f\n",k,sum);
			k++;
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 118