C++ program to read temperature in Centigrade and convert into Fahrenheit

//Formula is:
// (C-0)/(100-0)=(F-32)/(212-32)
#include <iostream>
using namespace std;
int main()
{
    float c,f;
    cout<<"Enter temperature in Centigrade: ";
    cin>>c;
    f=(212-32)/(100-0)*(c-0)+32;
    cout<<"Equivalent temperature in Fahrenheit is "<<f;
    return 0;
}

No comments:

Post a Comment