Code:
#include<iostream>
#include<conio.h>
using std::cout;
using std::cin;
using std::endl;
// functions prototypes
double Celsius( double );
double Fahrenheit( double );
int main()
{
// declare varibales
double tempCelsius, tempFahrenheit;
// read temperatures
cout<< "Enter temperature in Celsius scale:";
cin>> tempCelsius;
cout<< "\nEnter temperature in Fahrenheit scale:";
cin>> tempFahrenheit;
// display results
cout<< "\n" << tempCelsius << "c = " << Celsius( tempFahrenheit ) << "F";
cout<< "\n" << tempFahrenheit << "F = " << Fahrenheit( tempCelsius ) << "c";
getch();
}
// definitions of Celsius() & Fahrenheit()
double Celsius( double valueA )
{
return (5/9)*(valueA-32);
}
double Fahrenheit( double valueB )
{
return (9/5)*valueB+32;
}
This code gives the right answer for celsius temperature when converted from fahrenheit scale but centigrade scale to fahrenheit it gives only 0F as answer.
help needed/