Even Odd in Matlab

Published on 28 April 2022 (Updated: 02 February 2023)

Even Odd in Matlab

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

Current Solution

function result_string= odd_even(number)

%number - input by user
%result_string - output determined by this program
if (nargin==0)
    %if there was no input
    result_string = 'please input a number';
elseif ~isnumeric(number) || mod(number,1) ~= 0
    %check whether input is a number
    %also check if input is an integer
    result_string = 'please input a number';
    if mod(number,2) == 0
        result_string = 'Even';
        result_string = 'Odd';

Even Odd in Matlab was written by:

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

Note: The solution shown above is the current solution in the Sample Programs repository as of May 22 2021 15:02:49. The solution was first committed on Oct 11 2019 15:40:27. As a result, documentation below may be outdated.

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.