Even Odd in Odin

Published on 12 July 2024 (Updated: 12 July 2024)

Welcome to the Even Odd in Odin page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

package main

import "core:fmt"
import "core:strconv"
import "core:os"

main :: proc() {
    if len(os.args) != 2 {
        usage()
        return
    }
    n, ok := strconv.parse_int(os.args[1])
    if !ok {
        usage()
        return
    }
    evenodd(n)
}

evenodd :: proc(n: int) {
    if n % 2 == 0 {
        fmt.println("Even")
    } else {
        fmt.println("Odd")
    }
}

usage :: proc() {
    fmt.println("Usage: please input a number")
}

Even Odd in Odin was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.