View Code of Problem 118

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

Double click to view unformatted code.


Back to problem 118