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

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

Step by Step Solution

3.45 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

function summedValue OddsSumuserNum Matlab function that takes an integer userNum suct that us... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!