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

Create a function that will accept a scalar value from the function call and wil

ID: 3631530 • Letter: C

Question

Create a function that will accept a scalar value from the function call and will return (send back) nothing to the function call. The scalar value will be the number of rows a pattern will contain. The function should employ a nested loop to produce an output pattern that resembles the examples given below.

Example 1 – Input is 4 Example 2 – Input is 6
1 1
2 4 2 4
3 6 9 3 6 9
4 8 12 16 4 8 12 16
5 10 15 20 25
6 12 18 24 30 36



In the script file, prompt the user to enter the whole number greater than 0. You may assume that the user will enter a whole number, but you should employ a loop to confirm the user entered a number greater than zero and prompt the user to re-enter the value if not greater than zero. After validity of the user’s entry has been confirmed, call the function

Explanation / Answer

function ret = call(n) if n > 0 for i = 1:n for k = 1:2 for j = 1:i fprintf('%d ',i*j); end end fprintf(' '); end else error('Please enter a positive integer!'); end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote