Question: Write a MATLAB script (or function) to calculate the sum of the squares of the first n odd positive integers, where n is specified by
Write a MATLAB script (or function) to calculate the sum of the squares of the first n odd positive integers, where n is specified by the user. Your program should output (or print) n and the sum of the squares. For instance, if n = 3, your program should output (or print) the values 3 and 35, since the sum of the first three squares is. I2 + 32 + 52 = 35 Your code should use for... end or while statements. The basic syntax of the for and while statements is as follows: for i = l : n block of statements end while (logical expression) block of statements
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
