#WSQ02

The objective of this program is to convert temperature in Fahrenheit to Celsius, and will also tell  you the state of the water at that temperature. Here’s the code:

#include <iostream>

using namespace std;

int main ()
{
int f, c, w;

cout<<“Introduce the temperature in Fahrenheit and I will convert it to Celsius.”<<endl;
cout<<“I will also tell you the state of water at that temperature.”<<endl;
cin>>f;
c=5*(f-32)/9;
cout<<“The temperature in Celius is “<<c<<“.”<<endl;
if (c>=100)
{
cout<<“Water is at its boiling temperature.”<<endl;
}
else if (c==4)
{
cout<<“Water is at its maximum density.”<<endl;
}
else if (c<100 && c>0)
{
cout<<“Water is not yet at its boiling temperature.”<<endl;
}
else if (c<=0)
cout<<“Water is at its freezing temperature.”<<endl;
return 0;
}

WSQ02.png

Leave a comment