Program to convert Celsius to Fahrenheit in C++

Given temperature in °C, we have to write a program to convert it in °F and print it on the screen.

To convert Celsius to Fahrenheit, we  use the given formula:


# Algorithm

  1. Input the temperature and store it in c
  2. Calculate the temperature in Fahrenheit using the above formula and store it in f
  3. Print f


#include <iostream>
using namespace std;

int main()


	float c;

	cout << "Enter temperature in Celsius\n";	//inputting the temperature

	cin >> c;

	float f = (9 *c) / 5;	//calculating the first part of the formula

	f += 32;	//calculating the remaining part

	cout << "temperature in Fahrenheit:" << f;	//printing the calculated



Enter temperature in Celsius
temperature in Fahrenheit:96.8

Report Error/ Suggestion

Related Posts:

CopyRight © 2020

CopyRight © 2020