알고리즘 3 - Simple multiplication

jabae·2021년 10월 4일
0

알고리즘

목록 보기
3/97

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);
}
profile
it's me!:)

0개의 댓글