Write a function isdivby4 that will receive an integer input argument, and will return logical 1 for true if the input argument is divisible by 4, or logical false if it is not
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:3| Question number:28.3
All Answers
total answers (1)
isdivby4.m
function out = isdivby4(inarg)
% Returns 1 for true if the input argument is
% divisible by 4 or 0 for false if not
% Format of call: isdivby4(input arg)
% Returns whether divisible by 4 or not
out = rem(inarg,4) == 0;
end
need an explanation for this answer? contact us directly to get an explanation for this answer