C++ Program to Perform Conversion from Celsius to Fahrenheit or Fahrenheit to Celsius


#include<iostream>

int main()

{

float temp,conv_result;

int choice;

std::cout<<"Conversion of Temperature From " << "\n 1.Celcius to Fahrenheit";

std::cout<<"\n 2.Fahrenheit Celcius to \n\n1Enter your choice:";

std::cin>>choice;

switch(choice)

{

case 1:

{

std::cout<<"\nPlease Enter temperature in Fahrenheit:";

std::cin>>temp;

conv_result=(temp-32)/1.8;

}

break;

case 2:

{

std::cout<<"\n please Enter the temperature in Celcius:";

std::cin>>temp;

conv_result=(temp*1.8)+32;

}

break;

}

std::cout<<"\n Converted Temperature is :="<<conv_result;

}

Output:-

Leave a Reply

Your email address will not be published. Required fields are marked *