DigitalOrgano

  • Home
  • About
  • Categories
    • Windows OS
    • Software
    • Android
    • Technology
  • Contact
DigitalOrgano » Technology » C++ Program To Convert Fahrenheit to Centigrade

C++ Program To Convert Fahrenheit to Centigrade

Last updated on June 22, 2020 by Editorial Staff Under Technology

Tweet
Share
Share
Pin

Fahrenheit and Centigrade are both the unit of temperature in which they tells us the degree of hotness and coldness. The difference between them is that

Centigrade = (Fahrenheit – 32) x (5.0 / 9.0)

So using the above formula we will write a C++ program that will convert Fahrenheit to Centigrade

#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
    float cen, fah;
    cout<<"Convert Fahrenheit to Centigrade"<<endl;
    cout<<"Fahrenheit: ";
    cin>>fah;
    cen=(fah-32)*(5.0/9.0);
    cout<<fah<<" Fahrenheit = "<<cen<<" Centigrade";
    getch();
    return 0;
}

Explanation

We declare the float cen for Centigrade and fah for Fahrenheit as temperature can have decimal value

The program ask for Fahrenheit value from the user and convert it to Centigrade in the line 10 and it print the output

N.B. In line 10 do not remove the zero from 5.0 or 9.0 because it will give an error as it is a float value

Compiler Used: Code Blocks

Output

C++-Program-To-Convert-Fahrenheit-to-Centigrade

« Make Computer Speak Any Entered Words
Enable Delete Confirmation Dialog In Windows 8 »

Our Social Links

  • facebook
  • instagram
  • feedburner

Latest Articles

  • Create Shortcut For Any Program Or Folder In My Computer
  • The Best Way To Post Story On Instagram Using PC
  • Download Latest Google Chrome Offline Installer
  • 5 Best Ways to Free Up Drive Space on Windows 10
  • How to Enable Dark Mode in Microsoft Office
  • How to Properly Restore Windows Registry in Windows 10
Copyright © 2025 DigitalOrgano