Conversion from Fahrenheit to Celsius problem
I'm doing a simple code which converts an entered amount of degrees Fahrenheit to Celsius. I'm running sample test data and there appears to be a converting problem.
Code:
//This program will convert a temperature of Fahrenheit to Celsius
#include <iostream>
using namespace std;
//Function Prototypes
int Celsius(int);
int main()
{
int F, // # of degrees Fahrenheit
C; // # of degrees Celsius
cout <<"This program will convert a temperature of Fahrenheit to Celsius." << endl;
cout <<"Please enter the amount of degrees (integer) Fahrenheit." << endl;
cin >> F;
C = Celsius(F);
cout << F << " degrees Fahrenheit converted to Celsius is " << C << endl;
system("pause");
return 0;
}
//************************************************
//Definition of function Celsius. *
//This function converts Fahrenheit to Celsius. *
//************************************************
int Celsius(int F)
{
return ((5 / 9) * (F - 32)); // Formula used to convert Fahrenheit to Celsius
}
My first test data was 32 and it came out correctly with a conversion of 0 degrees Celsius. When I tried one (1), it gave me an output of zero (0) as with others numbers I have entered. Can you help me identify the problem?
Edit:
I know some answers will come out with a decimal, but I'm only concerned with "whole" numbers.