Hey everyone, I am very confused on why my program is not working. It is suppose to run through a loop give a Fahrenheit Temp 0-20 and displaying the Celsius Temp next to each one. I am suppose to call the Celsius value from a function. Here is what i have:
What i get is the Fahrenheit temp going from 0-20 but the Celsius is always 0? Everything looks correct after look at similar examples from my book.
Code:
#include <iostream>
using namespace std;
int celsius(int);
int main()
{
int c;
for (int x = 0; x <= 20; x++)
{
c = celsius(x);
cout << "The Temperature in Fahrenheit is " << x << " The Temperature in Celsius is " << c << endl;
}
return 0;
}
int celsius(int x)
{
return ((5/9)(x - 32));
}
What i get is the Fahrenheit temp going from 0-20 but the Celsius is always 0? Everything looks correct after look at similar examples from my book.