Write C++ to Converts Celsius to Fahrenheit


Converts Celsius to Fahrenheit

You can get complete code of C++ of this programming here ; DOWNLOAD C++ code

#include <iostream> //no need to use the whole std namespace... use what you need :) using std::cout; using std::cin; using std::endl; int main() { //Variables float celsius, //represents the temperature in Celsius degrees fahrenheit; //represents the converted temperature in Fahrenheit degrees //Ask for the temperature in Celsius degrees cout << "Enter Celsius temperature: "; cin >> celsius; //Formula to convert degrees in Celsius to Fahrenheit degrees //Important note: floating point literals need to have the '.0'! fahrenheit = celsius * 9.0/5.0 + 32.0; //Print the converted temperature to the console cout << "Fahrenheit = " << fahrenheit << endl; }
The Output
Enter Celsius temperature: 28
Fahrenheit = 82.4
Previous Post Next Post