Wednesday, 15 April 2020

C++ Question - Farenheit to Celcius

Q: Write a program which accept temperature in Fahrenheit and print it in centigrade.
Solution:

#include <iostream>
using namespace std;

int main(int argc, char *argv[])
{
 float F,C;
 cout<< "\nEnter temperature in Farenheit : ";
 cin>>F;
 C=5*(F-32)/9;
 cout<<"Temperature in celcius is : "<<C;
 return 0;
}

Screenshot:

No comments:

Post a Comment