Hi all,
I'm a beginner and I tried to write a program to convert celsius into Fahrenheit but i have a problem due to type casting operation.
That is even though i explicitly converted an integer to float number I'm getting only integer value .
Here's the program :
# include<iostream>
using namespace std;
int main()
{
float celsius;
cout<<"Enter the temperature in celsius: ";
cin>>celsius;
float fahrenheit =(celsius*static_cast<float>(9/5))+32;
cout<<"Temperature in Fahrenheit = "<<fahrenheit<<endl;
return 0;
}
Please tell me what is wrong with that code with explanation .
Thanks in advance.