C++ Program to convert temperature from Fahrenheit to Celsius

C++ Program to convert temperature from Fahrenheit to Celsius 

Here is the C++ code to convert temperature from Fahrenheit to Celsius . It takes input from user in Fahrenheit and convert it into Celsius . You all should have in mind how it works exactly. Here is the algorithm.

  Steps
User side:
1: User asked to enter temperature in Fahrenheit 
2: User displayed temperature in Celsius.
Developer side
1: Declare variables that are going to be used in program.
2: Input temperature from user in Fahrenheit (input in a float variable)
3: Calculate temperature in Celsius using the following formula c=(f-32)/.8; (store result in a float variable)
4: Show up the resluts on screen.
5: Program ends here


Code:
#include <iostream>
#include <string>
using namespace std;

int main()
float f,c;
    cout<<"Enter temprature in Faranheight ";
    cin>>f;
    c=(f-32)/.8;
    cout<<"Temprature in celsius is=    "<<c<<endl;
   system("pause");
   return 0;

}

Output:

Comments