Program for converting temperature from fahrenheit to celsius or the revese way depends on user's Choice.
#include<iostream.h>
int main()
{
int choice;
float temp,countp;
cout<<"Temperature conversion Menu "<<"\n";
cout<<1.Fahrenheit to celsius "<<"\n";
cout<<"Enter the choice";
cin>>choice;
if(choice= =1)
{
cout<<"\n"<<Enter temp. fahren.:";
cin>>temp;
countp=(temp - 32)/1.8;
cout<<"The temp. in celsius is :"<<countp<<"\n";
}
else
{
cout<<"\n"<<"Enter temp . in centigrade";
cin<<temp;
countp=1.8*temp+32;
cout<<"The temp. in fahre. is : "<<countp<<"\n";
}
return 0;
}
Output :
Temperature conversion Menu
1. Fahrenheit to celsius
2. celsius to Fahrenheit
Enter the choice :2
Enter temp. centigrade:37
The temp. in fahre. is : 98.6
No comments:
Post a Comment