Week 2
a) Write a C++ program to convert centigrade into Fahrenheit. Formula:C=(F-32)/1.8
AIM:To convert temperature into centigrade
Program::
#include< iostream >
using namespace std;
int main()
{
float c,f;
cout<<"Enter the temperature in fahrenheit" << endl;
cin>>f;
c=(f-32)/1.8; //c=5(f-32)/9;
cout<< "Temperature in centigrade is " << c;
}
Output::
Enter the temperature in fahrenheit 212 Temperature in centigrade is 100

No comments:
Post a Comment