Question: Write a function sumsteps 2 with a single input argument n that uses a for loop to calculate and return the sum of 1 to

Write a function sumsteps2 with a single input argument n that uses a for loop to calculate and
return the sum of 1 to n in steps of 2. For example, if n is 7, the function would return 16
(1+3+5+7). Examples of calling the function are as follows:
>> sumsteps2(11)>> sumsteps2(12)
ans ans
=36=36

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!