C++ Program to convert Celsius to Fahrenheit or Fahrenheit to Celsius depending on user's choice with output
C++ Program to convert Celsius to Fahrenheit or Fahrenheit to Celsius depending on user's choice with output
IDE USED: - Codeblocks
Formula used:-
- Fahrenheit to Celsius: -(temp-32)/1.8
- Celsius to Fahrenheit: -1.8*temp+32
techeeINDIA |
#include<iostream>
using namespace std;
int main()
{
int choice;
float temp, countemp;
cout<<"\nTemperature conversion Menu : ";
cout<<"\n 1.Fahrenheit to Celsius ";
cout<<"\n 2.Celsius to Fahrenheit ";
cout<<"\nEnter the choice ";
cin>>choice;
if(choice==1)
{
cout<<"\nEnter temperature in Fahrenheit : ";
cin>>temp;
countemp=(temp-32)/1.8;
cout<<"\nThe Temperature in Celsius is : "<<countemp;
}
else
{
cout<<"\nEnter temperature in Celsius : ";
cin>>temp;
countemp=1.8*temp+32;
cout<<"\nThe temperature in Fahrenheit is :"<<countemp;
}
return 0;
}
OUTPUT: -
Here we select choice 2
techeeINDIA |
-JAI HIND
Program to convert Celsius to Fahrenheit or Fahrenheit to Celsius depending on user's choice with output
C++ Program to convert Celsius to Fahrenheit or Fahrenheit to Celsius depending on user's choice with output
Reviewed by mushrafkhan772
on
July 03, 2018
Rating:
Interesting program bro.
ReplyDeleteNice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. Bitcoin theft insurance
ReplyDelete