Celsius to Fahrenheit or vice versa
208 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Creating a program to convert Celsius to Fahrenheit
2 commentaires
Walter Roberson
le 9 Jan 2020
Déplacé(e) : DGM
le 2 Mai 2024
We don't know given that little information.
T*9/5+32
Réponse acceptée
Amit
le 21 Jan 2014
disp('This program convert Celsius to Fahrenheit');
Celsius=input('Write a temperature in Celsius and you''ll have the result in Fahrenheit: ');
disp([ 'x = ' num2str(Celsius) ' Celcius and y = ' num2str(Celsius*1.8+32) ' Fahrenheit'])
1 commentaire
Amit
le 21 Jan 2014
For both cases:
disp('This program convert Celsius to Fahrenheit');
val = input('Type 1 for Celcius to Farenheit and Type 2 for vice versa: ');
switch val
case 1
Celsius=input('Write a temperature in Celsius and you''ll have the result in Fahrenheit: ');
disp([ 'x = ' num2str(Celsius) ' Celcius and y = ' num2str(Celsius*1.8+32) ' Fahrenheit']);
case 2
Faren=input('Write a temperature in Farenheit and you''ll have the result in Celcius: ');
disp([ 'x = ' num2str(Faren) ' Fahrenheit and y = ' num2str((Faren-32)/1.8) ' Celcius ' ]);
end
Voir également
Catégories
En savoir plus sur Motion Modeling and Coordinate Systems dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!