Using switch to identify even or dd
조회 수: 1(최근 30일)
Problem in brief: Print “Odd” if the argument is 1, 3, or 5, “Even” if the argument is 0, 2, or 4, and “Let me get back to you on that one.” for any other value.
function [y] = even_odd(x)
r = mod(x,2);
case x<=4 && r ==0
case x<=5 && r == 1
fprintf('i will get back to you on that \n')
I dont understand why this function doesn't give the correct response. Please provide insights.