- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Program for Celsius To Fahrenheit conversion in C++
Given with temperature ‘n’ in Celsius the challenge is to convert the given temperature to Fahrenheit and display it.
Example
Input 1-: 100.00 Output -: 212.00 Input 2-: -40 Output-: -40
For converting the temperature from Celsius to Fahrenheit there is a formula which is given below
T(°F) = T(°C) × 9/5 + 32
Where, T(°C) is temperature in Celsius and T(°F) is temperature in Fahrenheit
Approach used below is as follows
- Input temperature in a float variable let’s say Celsius
- Apply the formula to convert the temperature into Fahrenheit
- Print Fahrenheit
ALGORITHM
Start Step 1 -> Declare a function to convert Celsius to Fahrenheit void cal(float cel) use formula float fahr = (cel * 9 / 5) + 32 print cel fahr Step 2 -> In main() Declare variable as float Celsius Call function cal(Celsius) Stop
Using C
Example
#include <stdio.h> //convert Celsius to fahrenheit void cal(float cel){ float fahr = (cel * 9 / 5) + 32; printf("%.2f Celsius = %.2f Fahrenheit", cel, fahr); } int main(){ float Celsius=100.00; cal(Celsius); return 0; }
Output
100.00 Celsius = 212.00 Fahrenheit
Using C++
Example
#include <bits/stdc++.h> using namespace std; float cel(float n){ return ((n * 9.0 / 5.0) + 32.0); } int main(){ float n = 20.0; cout << cel(n); return 0; }
Output
68
- Related Articles
- Program for Fahrenheit to Celsius conversion in C
- C# Program to perform Celsius to Fahrenheit Conversion
- Program for Fahrenheit to Kelvin conversion in C++
- Explain the conversion of Celsius and Fahrenheit.
- C# Program to Convert Fahrenheit to Celsius
- C++ program to convert Fahrenheit to Celsius
- Convert Fahrenheit to Celsius using C Program
- How to convert Celsius to Fahrenheit and Fahrenheit to Celsius?
- How to convert Fahrenheit into Celsius and, Celsius into Fahrenheit ?
- How to convert Celsius into Fahrenheit?
- Relation Between Celsius and Fahrenheit
- How to Convert Celsius To Fahrenheit using Python?
- Write a program in Python Pandas to convert a dataframe Celsius data column into Fahrenheit
- Program for Binary To Decimal Conversion in C++
- Program for Decimal to Binary Conversion in C++

Advertisements