View Code of Problem 118

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main() {
	int n;
	double price;
	int count=1;
	while(scanf("%d",&n)!=EOF){
		if(n<=3){
			price=5;
		}
		else{
			price=(n-3)*1.5+5;
			if(price>(int)price){
				price=(int)price+1;
			}
		} 
		printf("Case #%d: %.0lf\n",count,price);
		count++;
	}
}

Double click to view unformatted code.


Back to problem 118