How to write the code that takes input as fahrenheit and display Celsius?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ashfaq Ahmed
el 1 de En. de 2022
Comentada: Shreyan Basu Ray
el 1 de En. de 2022
Hi all,
I want to write down the code that takes an input and covert it to the desired answer. for example,
f = input('Enter temperature in Fahrenheit:')
c = (f-32)*5/9;
fprintf('The corresponding temperature in Celsius is: %2.2f','c')
Can you please tell me why this is not working?
3 comentarios
Shreyan Basu Ray
el 1 de En. de 2022
Try to put in the value of f, instead of getting it from the user. Say,
f = 100;
c = (f-32)*5/9;
fprintf('The corresponding temperature in Celsius is: %2.2f',c)
Now you should be able to see. This is happening because, here in this particular workspace, Matlab is not having any support for user input.
Respuesta aceptada
Walter Roberson
el 1 de En. de 2022
f = input('Enter temperature in Fahrenheit: ')
c = (f-32)*5/9;
fprintf('The corresponding temperature in Celsius is: %2.2f\n', c)
4 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Structures en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!