View Code of Problem 118

#include<iostream>
using namespace std;

int main()
{
	int n;
	int k = 1;
	while (cin >> n) {
		double m = 5;
		if (n > 3) {
			if ((n - 3) % 2 != 0) m += 0.5;
			m += 1.5*(n - 3);
		}
			
		cout << "Case #" << k << ": " << m << endl;
		++k;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 118