Ask Question
26 June, 17:43

Using a while loop, write a code that will continue to calculate the following equation until the solution gets to be above 100, x will start at zero. What is the final solution and how many iterations does it take to complete (prob05) as a row vector.

+3
Answers (1)
  1. 26 June, 18:11
    0
    prob05. m

    clc

    x=0;

    sum=0;

    iteration=0;

    while (sum<100)

    x=2*x+1;

    sum=sum+x;

    x=x+1;

    iteration=iteration+1;

    end

    fprintf ('total iteraton take to sum greater than 100 is %d and sum becomes %d/n', iteration, sum);
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Using a while loop, write a code that will continue to calculate the following equation until the solution gets to be above 100, x will ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers