Even Odd

Published on 21 October 2018 (Updated: 15 December 2024)

Welcome to the Even Odd page! Here, you'll find a description of the project as well as a list of sample programs written in various languages.

This article was written by:

Description

An even number is an integer which is "evenly divisible" by two. This means that if the integer is divided by 2, it yields no remainder.

An odd number is an integer which is not evenly divisible by two. This means that if the integer is divided by 2, it yields a remainder of 1.

Requirements

Create a file called "Even Odd" using the naming convention appropriate for your language of choice.

Write a sample program which accepts an integer on the command line and outputs if the integer is Even or Odd.

Testing

Every project in the Sample Programs repo should be tested. In this section, we specify the set of tests specific to Even Odd. In order to keep things simple, we split up the testing as follows:

Even Odd Valid Tests

Description Input Output
Sample Input: Even "2" "Even"
Sample Input: Odd "5" "Odd"
Sample Input: Negative Even "-14" "Even"
Sample Input: Negative Odd "-27" "Odd"

Even Odd Invalid Tests

Description Input
No Input  
Empty Input ""
Invalid Input: Not A Number "a"

All of these tests should output the following:

Usage: please input a number

Articles

There are 40 articles: