Programming

C++ Program & Algorithm Convert Celsius to Fahrenheit

Write a program that will ask for temperature in Celsius and display it in Fahrenheit.

Algorithm

  • Step 1: Start
  • Step 2: Read temperature in Celsius, c
  • Step 3: f=(9*c)/5+32
  • Step 4: Display temperature in Fahrenheit, f
  • Step 5: End

Source Code

#include<iostream>

#include<conio.h>

using namespace std;

int main ()

{

    float x, cel,fah;

    cout<<"Input temperature in celsius:"<endl;

    cin>>cel;

    fah=(9*cel)/5+32;

    cout<<endl<<"the temperature in fahrenheit is "<<fah <<endl;

    getch();

}

Output

Convert Celsius to Fahrenheit

Tuts

About Author

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.