Even Odd in Matlab

Published on 11 October 2019 (Updated: 22 May 2021)

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';
else
    if mod(number,2) == 0
        result_string = 'Even';
    else
        result_string = 'Odd';
    end
end
end
        

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