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

What is the value of work done on an object when a 70 newton force moves the object 9 meters in the same direction as the force?
a+2xy=14 solve for y
Which are aspects of the Voting Rights Act of 1965? Select all that apply. A) It outlaws literacy tests as a requirement to vote. B) It outlaws segregation in p
According to the gate control theory, what is one reason we are able to block the perception of pain?
It is expected that as the temperature goes up by the above method, frozen carbon dioxide will defrost and evaporate into the atmosphere, raising temperatures e
Read the story "The Legend of the Lady Slipper." Why does the little girl go on a dangerous journey?
10. A pizzeria charges $11.00 for a large cheese pizza and $0.75 per topping on the pizza. Find the slope. A. $11.00 B. $0.75 C. $11.75 D. $10.25​
pless answer thisss!!​
Answer please today I need help it’s due today
True or false? Propaganda is biased, which means that it fairly represents both sides to an argument.