NBA - Boston Celtics

Thursday, 26 January 2012

Celsius to Fahrenheit Converter



#include<iostream.h>
main()
{
int ctemp, ftemp, select=0;
cout<<"press 1 for Fahrenheit - Celsius \n";
cout<<"press 2 for Celsius - Fahrenheit\n";
cout<<"enter : ";
cin>>select;
if (select == 1)
{
cout<<"enter your temp in Fahrenheit to convert in Celsius  :";
cin>>ftemp;
ctemp=(ftemp-32)*5/9;
cout<<"temp in Celsius is :"<<ctemp;
}
else if (select == 2)
{
cout<<"enter you temp in Celsius to convert into Fahrenheit :";
cin>>ctemp;
ftemp=(ctemp*9/5)+32;
cout<<"temp in Fahrenheit is :"<<ftemp;
}
else
{
cout<<"valid choise are 1 and 2 ";
}
}


No comments:

Post a Comment