Tercer Programa

#WSQ02 #TC1017

En este tercer programa hicimos una operación para calcular la equivalencia de temperatura en grados Fahrenheit a grados Celsius. Utilizamos la fórmula:

–temp_celsius= 5 *(temp_fahrenheit-32)/9;–

Utilizamos una función principal –int main– , dos variables tipo entero (temp_fahrenheit, temp_celsius), un mensaje para pedirle al usuario que introduzca una temperatura en grados Fahrenheit y la entrada de la variable  –temp_fahrenheit– para realizar los cálculos y regresar el resultado con la operación –temp_celsius= 5 *(temp_fahrenheit-32)/9;– a través de la variable –temp_celsius–.

Programa:

#include <iostream>
using namespace std;
int main ()
{
int temp_fahrenheit,temp_celsius;
cout<<«Introduce a temperature in Fahrenheit degrees to convert in Celsius degrees «;
cin>>temp_fahrenheit;
temp_celsius= 5 *(temp_fahrenheit-32)/9;
cout<<«The temperature in Celcius degrees is «<<temp_celsius<<endl;
return 0;
}

temperature (código)temperature (programa)

Deja un comentario