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.

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.

The following table contains various test cases that you can use to verify the correctness of your solution:

Description | Input | Output |
---|---|---|

no input | None | Usage: please input a number |

empty input | "" | Usage: please input a number |

invalid input: not a number | a | Usage: please input a number |

sample input: even | 2 | Even |

sample input: odd | 5 | Odd |

sample input: negative even | -14 | Even |

sample input: negative odd | -27 | Odd |

- Even Odd in Bash
- Even Odd in C
- Even Odd in C#
- Even Odd in C++
- Even Odd in Cobol
- Even Odd in Coffeescript
- Even Odd in Dart
- Even Odd in Elixir
- Even Odd in Fortran
- Even Odd in Go
- Even Odd in Groovy
- Even Odd in Haskell
- Even Odd in Java
- Even Odd in Javascript
- Even Odd in Julia
- Even Odd in Kotlin
- Even Odd in Lisp
- Even Odd in Lua
- Even Odd in Matlab
- Even Odd in Objective C
- Even Odd in P4
- Even Odd in Pascal
- Even Odd in Perl
- Even Odd in Php
- Even Odd in Python
- Even Odd in R
- Even Odd in Rexx
- Even Odd in Ruby
- Even Odd in Rust
- Even Odd in Swift