Hi, I am stuck and am trying to create a loop for this question: Create a program that outputs the state of water (liquid, solid or gas) based on the following temperatures (degrees C): -25, 120, -11, 55, 99, 155, 133, 11. Thank you!
I am writing the pseudo code. You can write down the final code in whichever language you are using.
First declare an array of the given temperatures.
Let it be
t=[-25,120,-11,55,99,155,133,11]
then take a variable for indexing. let it be i.
initialize i
i=0 // for MATLAB take i=1
for (i=0;i<=7;i++)
{
if (t[i]<=0)
print("State of water is solid");
elseif(0<t[i]<=100)
print("State of water is liquid");
else
print("State of water is gas");
}
Get Answers For Free
Most questions answered within 1 hours.