Celsius to Fahrenheit

This is supposed to be a chart that displays degrees Celsius (0-20) along with the conversion in Fahrenheit. The chart is working but I can't seem to figure out how to get the correct Fahrenheit to show up. The only thing showing up in the Fahrenheit column is zeros.(I am a beginner)


#include <iostream>
using namespace std;
#include <iomanip>
int main ()

{

const int START_CEL = 0,
END_CEL = 20,
INCREMENT = 1;

int celsius;
double fahrenheit;

cout <<fixed << showpoint << setprecision(1);

{
cout << "Celsius\tFahrenheit\n";
cout << "________________________\n";
}

for (celsius = START_CEL; celsius <= END_CEL; celsius += INCREMENT)

{
fahrenheit = (5/9) * (celsius + 32);

cout << celsius << "\t" << fahrenheit << endl;

}








return 0;
}
closed account (E3h7X9L8)
you must put 5.0/9 either the result would be 0 * anything else = 0 , because 5 is not a double integer its a normal integer so the result isnt a double integer

but also you got the formula wrong , did some research on temperature conversion and this is the right formula for celsius to fahrenheit conversion

fahrenheit = (celsius * 9.0/5) + 32 ;
Topic archived. No new replies allowed.