Ticker

6/recent/ticker-posts

Header Ads Widget

Program to convert Fahrenheit to Celsius or Celsius to Fahrenheit

Program to convert Fahrenheit to Celsius or Celsius to Fahrenheit || BigFootCODE


Celsius to Fahrenheit  , convert Fahrenheit , Program to convert Fahrenheit to Celsius or Celsius to Fahrenheit  , program , coding , cpp  , bigfootcode , mohitblog , mohit ka blog, mohit kumar , mohitkumar

Program to convert Fahrenheit to Celsius or Celsius to Fahrenheit

In this simple program of converting Fahrenheit to Celsius or Celsius to Fahrenheit firstly we give a small menu to the user so that he/she can decide what he want to do  Fahrenheit to Celsius or Celsius to Fahrenheit and on depending upon the user choice we receive the input  using a variable and then perform a function .

after that we allow user to enter the values so that we can process on it and provide a relevant output to the user.

Q) Write a program to convert Fahrenheit to Celsius or Celsius to Fahrenheit

sol)
#include<iostream.h> int main()
{int choice;
float temp,countemp;
cout<<"temperature conversion menu :";
cout<<"1. fahrenheit to Celsius "<<"\n";
cout<<"2. Celsius to fahrenhiet "<<"\n";
cout<<"enter your choice:" ;
cin>>choice ;
if(choice==1)
{ cout<<"\n"<<"enter temperature in Fahrenheit :";
cin>>temp ;
countemp = (temp -32)/1.8 ;
cout<<" the temperature in clesius is :"<<countemp<<"\n";
}else
{ cout<<"\n"<<"enter temperature in centigrade :";
cin>>temp;
countemp = 1.8*temp + 32 ;
cout<<" the temperature in Fahrenheit is : "<<countemp<<"\n";
}
return 0 ;
}

Note:- if any question or problem let us know put it in the comment below. join us for more !!




Other related questions:-

Post a Comment

0 Comments