jessysmith8109 jessysmith8109
  • 23-08-2019
  • Computers and Technology
contestada

convert for loop to while loop, that is the script

z1=zeros(10);
for x=1:10
for y=1:10
z1(x,y)=x^2-3*y
end
end
z1

Respuesta :

ExieFansler ExieFansler
  • 04-09-2019

Answer:

To convert for loop to while loop we have to first declare and initialize the integers or variables that will work as an counter.

script will be

z1=zeros(10);

x=1

while x<10

y=1

while y<10

z1(x,y)=x^2-3*y

y=y+1

end

x=x+1

end

z1

Remember that we have to update the counter every time that we not need to be done for loop.

Answer Link

Otras preguntas

Help pleaseeeee HAPPY EASTER
In triangle KLM,the measure
What does absolute value mean
The objective of _____ is to build sales, market share, and profits quickly by providing an incentive to purchase the product immediately. price lining price sk
What is the completely factored form of f of x equals x3 - 2x2 - 5x + 6
Pls help me to answer this question I am confused-Mathematics Class 10
which sentence uses the word enthrall correctly? We may enthrall before class, but we're not sure yet. Abbie won't enthrall her car keys again. Sheldon and Max
describe how state government is funded
Find X (geometry) thank you
List and briefly explain the characteristics all leaders must exhibit