A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
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:
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.
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.
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:
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" |
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
There are 39 articles: