View Code of Problem 118

#include<stdio.h>
#include<math.h>
int main(){
	int n;
	int flag=1;
	while(~scanf("%d",&n)){
		
		if(n>=1&&n<=3){
			printf("Case #%d: 5\n",flag);
			
		}
		else{
			int  price;
			if(n%2==0){
				price=(n-3)*1.5+6;
			}
			else 
				price=(n-3)*1.5+5;
			printf("Case #%d: %d\n",flag,price);
		}
		
		flag++;
	}
	
	
	
	
	return 0;
}

Double click to view unformatted code.


Back to problem 118