A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
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.
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.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.