C++ Online Compiler
Example: C++ program to convert temperature from degree Celsius to Fahrenheit
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// C++ program to convert temperature from degree Celsius to Fahrenheit #include <iostream> using namespace std; int main() { float c, f; // c = celsius // f = fahrenheit cout << "Enter the temperature in Celsius::\n"; cin >> c; /* celsius to fahrenheit conversion formula */ f = (float)((c * 9 / 5) + 32); // Output cout << "\n" << c << " Celsius = " << f << " Fahrenheit\n"; return 0; }
7
Output
Clear
ADVERTISEMENTS