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

The point of concurrency of the perpendicular bisectors of a triangle is called the _____
Jefferson think the people at the constitutional convention are overreacting to Shays rebellion what does he worried they might do as they write the new constit
A savings account deposit of $300 is to earn 5.8% interest. After how many years will the investment be worth $900?
A joint united by dense fibrocartilaginous tissue that usually permits a slight degree of movement is a ________.
Nitrogen has an atomic number of 7; therefore, it has _____ electrons in its outermost electron shell a. 1 b. 5 c. 10 d. 2 e. 18
how to convert 550 cm into m.
identify the conic section of xy=4
84 times four thirds
Since you can’t identify bacteria from a gram stain, why might a physician perform a gram stain on a sample before prescribing an antibiotic?
or Question 1: ___ of 5 points) 1. Devin is making a candle by pouring melted wax into a mold in the shape of a square pyramid. Each side of the base of th