Ask Question
26 June, 04:27

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.

+2
Answers (1)
  1. 26 June, 07:08
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers