알고리즘 3 - Simple multiplication

Q.

This kata is about multiplying a given number by eight if it is an even number and by nine otherwise.

A)

int simple_multiplication(int number) {
    if (number % 2 ==0)
      return (number * 8);
    else
      return (number * 9);
}

좋은 웹페이지 즐겨찾기