Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

matlab 7. Use a for loop no determine the and number of all odd integers from 1

ID: 3857371 • Letter: M

Question


matlab

7. Use a for loop no determine the and number of all odd integers from 1 to 100 which is divisible by 3. sum Use fprintf to display the answers as below. sum of all odd integers from l to 100 which is divisible by 3 867 number of odd integers from l to 100 which is divisible by 3 17 use a while loop to create a vector containing the first 10 elements in the harmonic series ie. ents in the harmonic scries Columns 1 through 8 1/2 13 14 1US 126 Columns 9 through 10 9 Use a for loop to create containing the first 10 elements in the harmonic series ie a vector 1/2 1/5...

Explanation / Answer

7)

Matlab Programming :-

startValue=1;
stepValue=2;
stopValue=100;
theSum = 0;
theCount = 0;
for x = startValue : stepValue : stopValue
check = mod(x,3);
if check == 0
theSum = theSum + x;
theCount = theCount + 1;
end
end