This program shows how to change a temperature in Farenheit to Celsius
Celsius = (100 / 180) * (Farenheit - 32)
Source Code:
Output:
Celsius = (100 / 180) * (Farenheit - 32)
Source Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <iostream.h> #include <iomanip.h> #include <conio.h> const float cConversionFactor = 100.0 / 180.0 ; int main() { cout << " Enter the Temperature in Farenheit : "; float fareh; cin >> fareh; float cel = cConversionFactor * ( fareh - 32 ); cout << fixed; cout << showpoint; cout << setprecision(1); cout << " Farenheit Temperature : " << fareh << endl; cout << " Celsius Temperature : " << cel << endl; getch (); return 0; }// Main |
Output:
Enter the Temperature in Farenheit : 98.6 Farenheit Temperature : 98.6 Celsius Temperature : 37.0
No comments:
Post a Comment