matlab里,怎么用if语句判断奇数偶数?

一组数里,怎么用if语句判断奇数偶数?
2024-12-26 17:24:46
推荐回答(1个)
回答1:

xx = mod(x,2);
if(xx == 1)
x为奇数;
else
x为偶数;
end