CONVERT TEMPERATURE
Fahrenheit to the Celsius or Celsius to Fahrenheit
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int choice;
float temp,conv;
cout<<"temperature conversion menu"<<"\n";
cout<<"1.fahrenheit to celsius"<<"\n";
cout<<"2.celsius to fahrenheit"<<"\n";
cout<<"enter ur choice(1-2)";
cin>>choice;
if(choice==1)
{
cout<<"enter temp. in fahrenheit";
cin>>temp;
conv=(temp-32)/1.8;
cout<<"temp in celsius";
cout<<conv;
}
else
{
cout<<"enter temp. in celsius";
cin>>temp;
conv=(1.8*temp)+32;
cout<<conv;
}
getch();
}
Fahrenheit to the Celsius or Celsius to Fahrenheit
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int choice;
float temp,conv;
cout<<"temperature conversion menu"<<"\n";
cout<<"1.fahrenheit to celsius"<<"\n";
cout<<"2.celsius to fahrenheit"<<"\n";
cout<<"enter ur choice(1-2)";
cin>>choice;
if(choice==1)
{
cout<<"enter temp. in fahrenheit";
cin>>temp;
conv=(temp-32)/1.8;
cout<<"temp in celsius";
cout<<conv;
}
else
{
cout<<"enter temp. in celsius";
cin>>temp;
conv=(1.8*temp)+32;
cout<<conv;
}
getch();
}
ty for program ....
ReplyDelete