Even or Odd 8 kyu: Codewars Solutions

Even or Odd

Create a function that takes an integer as an argument and returns "Even" for even numbers or "Odd" for odd numbers.

Solution

public class Kata {
    public static String evenOrOdd(int number) {
      if (number % 2 == 0) {
        return "Even";
      } else {
        return "Odd";
      }
    }
}
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments