Write a program to convert Fahrenheit to Celsius.the formula for the conversion is follows:
Celsius (5/9)*(Fahrenheit-32)
using namespace std;
#include <omp.h>
#include <stdio.h>
int main()
{
float Temp_in_deg,Temp_in_F;
int Choice=0,Flag=1;
while(Flag)
{
cout<<"\n\n\nSelect -> Press 1 for Deg. to Farenhite Conversion";
cout<<"\nSelect -> Press 2 for Farenhite to Deg. Conversion";
cout<<"\nSelect -> Press 0 to quit";
cout<<"\nEnter Choice = "; cin>>Choice;
if(Choice ==0) exit(0);
if(Choice ==1)
{
cout<<"\n\nEnter Temp. in deg. C = "; cin>>Temp_in_deg;
Temp_in_F = ((9*Temp_in_deg)/5) + 32;
cout<<"\n"<<Temp_in_deg<<" deg. C = "<<Temp_in_F<<" deg. F";
}
if(Choice == 2)
{
cout<<"\n\nEnter Temp. in deg. F = "; cin>>Temp_in_F;
Temp_in_deg = (5*(Temp_in_F - 32))/9;
cout<<"\n"<<Temp_in_F<<" deg. F = "<<Temp_in_deg<<" deg. C";
}
}
}
Comments
Leave a comment