I spoke too soon, there is a problem with that solution: h isn't
divisible by c for all values of N.
Counterexample: given N = 20, we get:
w = 17 * 20 = 340
h = 22 * 20 = 440
c = 17
but then:
h % c = 440 % 17 = 15, not 0.
I tried with values for N from 1 through 100 and the only time h was
divisible by c was when N was a multiple of 17 (so 17, 34, 51, etc).
Adam