View Code of Problem 118

#include<iostream>
using namespace std;
int main() {
	int n,k=1;
	while (cin >> n) {
		cout << "Case #" << k++ << ": ";
		if (n <= 3)
			cout<< 5 << endl;
		else {
			float sum = 5 + (n - 3)*1.5;
			if (n % 2 == 0)
				sum += 0.5;
			cout << sum << endl;
		}
	}
}

Double click to view unformatted code.


Back to problem 118