Question: Homework Assignment # 2 - Part 2 This assignment is worth 1 0 0 points and consists of two parts. This is Part 2 ,

Homework Assignment #2- Part 2
This assignment is worth 100 points and consists of two parts. This is Part 2, which covers user-controlled
data input and output. Both Part 1 and 2 are due Tuesday, October 8th on Canvas. Code must be
written in MATLAB, be well documented, and submitted as one M file using sections.
Recall the convergent geometric series from Problem #1 of Homework #2 Part #1. For this problem,
write a script that performs the following:
Prompt the user for input in the form of the number of terms to compute. Check for valid input,
and loop until the user enters a positive number greater than zero. If an invalid number is entered,
display a message reminding the user to enter a positive integer.
Use fprintf to output to the command window each term. See below for an example of what I
would like for the formatted output. Also, output to the command window the total as well as the
number of terms, as shown below. You may use either a while loop or for loop.
Example of the user entering 5(five terms):
Enter number of terms to compute: 5
1.00000+0.50000+0.25000+0.12500+0.06250=1.93750, number of terms =5
Specify five decimal places to the right of the decimal point for each term and the total, and no decimal
places for the number of terms.
Homework Assignment # 2 - Part 2 This assignment

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!