MATLAB: For loops: Odds sum Write a for loop that assigns summedValue with the sum of allodd
Fantastic news! We've Found the answer you've been seeking!
Question:
MATLAB: For loops: Odds sum
Write a for loop that assigns summedValue with the sum of allodd values from 1 to userNum. Assume userNume is always greaterthan or equal to 1.
Ex: If userNum is 5, then summedValue is 9 (i.e. 1 + 3 + 5 =9).
here is what I am given:
function summedValue = OddsSum(userNum)
summedValue = 0;
% Write a for loop that assigns summedValue withthe
% sum of all odd values from 1 to userNum
end
Related Book For
Posted Date: