j

Friday, 13 November 2015

Write a temperature conversion program that gives the user the option to converting the fahrenheit to Celsius to Fahrenheit. Then convert accourding to choice

 Program

Write a temperature conversion program that gives the user the option to converting the Fahrenheit to Celsius to Fahrenheit. Then carry out the conversion. Interaction of the program might look like this
       Enter 1 for convert Fahrenheit to Celsius.
       Enter 2 for convert Celsius to Fahrenheit.

Program Solution....

 #include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int op;
float f,c;
cout<<"Enter the choice\n Enter 1 for convert Fahrenheit to Celsius.\nEnter 2 for convert Celsius to Fahrenheit.";
cin>>op;
if(op==1)
cout<<"Enter the Celsius";
cin>>c;
f=9/5*c+32;
cout<<Fahrenheit =======>>>"<<f;
else if(op==2)
cout<<"Enter the Fahrenheit ";
cin>>f;
f=5/9*f-32;
cout<<Celsius =======>>>"<<f;
else
cout<<"Invalid Choice "
getch();
}

Subscribe to this Blog via Email :