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

suppose two different fractions with the same denominators are both less than 1 Can their sum equal 1? can their sum be greater than 1
an adult turtle weighed 3 3/4 ounces. how much would 3 adult turtles weigh?
Which statement does not accurately describe the Roman Empire? A. Elaborate public baths became the center of Roman social life and were open to all for a small
What helped slaves escape from the South? a) The President helped slaves escape the South. b) Slaveholders helped their own slaves escape the South. c)The Under
What is the area of a 15 ft circle
Explain the relationship between society and the technologies of using Earth's resources.
The lowlands west of Australia's eastern mountain range are drained by the Murray-Darling River system, with its main headwaters in the Great _______ Basin
What is the area of a 15 ft circle
What do sound waves, light waves, and ocean waves all have in common?
What are some similarities between soccer and lacrosse?