Question: HW 3 Practice Problem 3 Problem Description Consider the following sequence: 2 k , k = 1 , 2 , 3 , dots How many
HW Practice Problem
Problem Description
Consider the following sequence:
dots
How many sequential terms in this sequence can be added together without the total exceeding a specified value?
Resources
If you have not watched the Week Topic videos on this page specifically segments and you should watch them
before attempting this problem!
Strategy
Use a while loop to determine how many sequential terms in the sequence can be added together without the total exceeding a specified
value eg or
Start by answering the following questions we did this in the videos!:
What will the loop expression be
What variables need to be initialized before the loop?
What variables need to be updatedincremented inside the loop?
Instructions
Following the pseudocode from the videos, write your code in the "Script" box below.
After the while loop:
Assign the appropriate valueexpression to the variable numTerms.
Call fprintf to display the number of sequential terms in the sequence that can be added together without the total exceeding the
specified value.
Note that the autograder will be checking the following variables: total, and numTerms
Test your code using a small specified value eg so that you can check your answer on paper eg by completing the table below,
as we did in the videos
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
