Problem 200

Problem description here

This problem also required a simple loop over the range of numbers, and then calculating the K factor.

There are many things which can be cut here:

The input argument can be used in the outermost for() loop instead of the temporary variable
All the calculations can be done inside two for() loops

Here is the final solution

Highlights

  • for(;i<=e;) uses the input parameter i in the loop
  • m!=k & k >1 saves one character by using binary & instead of logic && which is the same when used on boolean arguments