Make and run a program that will convert a celsius degree from fahrenheit, kelvin, and rankine. The program should follow the desired steps: Celsius to fahrenheit to kelvin to rankine. Make one function for each conversion.Use FUNCTIONS and a Dev C++ application. sample output: Enter temperature in celsius: 1 The equivalent to fahrenheit->33.8 The equivalent to kelvin->274.15 The equivalent to rankine->493.47
#include <iostream> // include system information using namespace std; int main() { int F1, C1, K1, R1; // display initial program identification cout << "Conversion Between Temperature Scales " << "email@none.com" << endl << endl; // prompt the user for input cout << "Enter a temperature using the Fahrenheit scale: "; cin >> F1; // Conversion from F to C; C1 = 0.556 * (F1-32); cout << "deg Celcius is " << C1 << endl; // Conversion from C to K; K1 = 0.556 * (F1-32) + 273.15; //Conversion from F to R; R1 = F1 + 459.67; //Display results cout << "deg Farenheit is" << endl; //cout << C1 <<"deg Celcius" << K1 << "deg Kelvin"; //cout << R1 << "deg Rankine << endl; return 0; }
its equivalent in python is as follows:- def change_temp(): cel = input('Enter the temperature in Celsius: ') #input temperature in Celsius fah = (9.0/5.0)*cel + 32 #change of celsius into Fahrenheit kel = cel + 273.15 #change of celsius into Kelvin rank = (9.0/5.0)*cel + 491.67 #change of celsius into rankine print 'The equivalent to Fahrenheit is : ',fah print 'The equivalent to Kelvin is : ',kel print 'The equivalent to Rankine is : ',rank
Join our real-time social learning platform and learn together with your friends!