Even Odd in Octave

Published on 09 December 2023 (Updated: 09 December 2023)

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

Current Solution

function even_odd()
    usage = 'Usage: please input a number';
    arg_list = argv();
    nargin = length(arg_list);
    if (nargin==0)
        %if there was no input
        disp(usage);
    else
        number = str2num(arg_list{1});
        if length(number) ~= 1 || mod(number, 1) ~= 0
            %check whether input is a number
            %also check if input is an integer
            disp(usage);
        else
            if mod(number, 2) == 0
                disp('Even');
            else
                disp('Odd');
            end
        end
    end
end

Even Odd in Octave 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.