View Code of Problem 118

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










Double click to view unformatted code.


Back to problem 118