Question: PART 2 Lab) Q1. Write a Matlab program that prints N lines of output. On output line number k, the program should list the numbers
PART 2 Lab) Q1. Write a Matlab program that prints N lines of output. On output line number k, the program should list the numbers from k to 3k and together with the sum of odd numbers only. Note that there is a space between the printed numbers. You have to use loops to solve this problem. User input should be between 2 and 10, otherwise print "Invalid input" and ask the user to re-enter another input. (5 Marks) Same output is shown below" Please enter N: 5 1 23 The sum is 4 2 3456 The sum is 8 3456789 The sum is 24 456789 10 11 12 The sum is 32 5 6789 10 1112 13 14 15 The sum is 60 Please enter N: 12 Invalid input. Please re-enter N: 3 1 23 The sum is 4 23456 The sum is 8 3456789 The sum is 24
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
