Table of Contents
Program to convert Celsius into Fahrenheit-Entered by user
In this article, we will discuss the title of the “Program to convert Celsius into Fahrenheit-Entered by user”
In this post, we will learn how to write a program to convert Celsius into Fahrenheit(Using the user input ) and display the result on the screen.
Generally, we are using three temperature units Fahrenheit, Celsius, and Kelvin. Fahrenheit and Celsius are the measuring units in degrees as oF and oC respectively. In this article, we are discussing how to convert temperature units Fahrenheit into Celsius.
Kevin is an international unit in temperature measurement
Formula
F=C x 9/5 + 32
Algorithm
- Declare variables as double
- Ask for input from the user
- Apply the formula
- Print the temperature in Fahrenheit on the screen
Code to Celsius into Fahrenheit
Convert Celsius into Fahrenheit – Java
Java language
//Java program to Convert Celsius into Fahrenheit import java.util.Scanner; public class Celsius_To_Fahrenheit { public static void main (String args[]){ //variables decaration as double double fahre,cels; Scanner input=new Scanner(System.in); System.out.print("Enter the value to Celsius: "); //Takes input cels=input.nextDouble(); fahre=(cels*9/5)+32; //Calculate Fahrenheit value System.out.print("Temperature in Farhenheit:"+fahre); //print the resut } }
When the above code is executed, it produces the following result
Enter the value to Celsius: 70 Temperature in Farhenheit:158.0
Convert Celsius into Fahrenheit – C
// Program to convert celsius into fahrenheit #include <stdio.h> int main() { // declaring float type variables float celsius,fahrenheit; //Ask input from the user printf("Enter temperature in Celsius :"); //Reading the input scanf("%f",&celsius); //Convert celsius to fahrenheit fahrenheit=((celsius*9/5)+32); printf("%.2f Temperature in Fahrenheit is=%.2f ",celsius,fahrenheit); //Print the result on the screen return 0; }
When the above code is executed, it produces the following result
Enter temperature in Celsius:100 100.00 Temperature in Fahrenheit is=212.00
Convert Celsius into Fahrenheit – C++
//C++ program to convert C into f from user input #include <iostream> using namespace std; int main() { float celsius, fahrenheit; // variable declaration // takeinput from the user for cesius cout<<"Enter the temperature in Celsius:"; cin>>celsius;//reading the input //Calculate fahrenheit from given celsius value fahrenheit=(celsius * 9/5)+32; cout<<celsius<<" Celsius is the same to: "<<fahrenheit <<" Fahrenheit"; //display result on the screen return 0; }
When the above code is executed, it produces the following result
Enter the temperature in Celsius:95 95 Celsius is the same to 203 Fahrenheit
Convert Celsius into Fahrenheit -C#
// C# program to convert Celsius to Fahrenheit //Take input from user using System; namespace temperature { public class CelstoFahre { public static void Main(string[] args) { double celsius,fahrenheit; //Declare variables Console.WriteLine ("Enter temperature in Celsius: "); //Ask input from user celsius=Convert.ToDouble(Console.ReadLine()); //Reading the input fahrenheit=(1.8*celsius)+32; //Caculate Fahrenheit using given Celsius value Console.WriteLine ("The temperature in fahrenheit is: "+fahrenheit); //Display result on the screen Console.ReadKey(); } } }
When the above code is executed, it produces the following result
Enter temperature in Celsius: 80 The temperature in Fahrenheit is: 176
Convert Celsius into Fahrenheit – Python
# Python program to convert temperature in Celsius to Fahrenheit celsius=float(input("Enter temperature in Celsius ")) #Take input from the user #Calculate Fahrenheit fahrenheit=(celsius*1.8)+32 #Ptint result on the screen print('%0.1f degree Celsius is equal to %0.1f degrees Fahrenheit' %(celsius,fahrenheit))
When the above code is executed, it produces the following result
Enter temperature in Celsius 99.0 99.0 degree Celsius is equal to 210.2 degrees Fahrenheit
Convert Celsius into Fahrenheit – PHP
<?php //php code to convert Celsius to Fahrenheit $celsius=readline("Enter the Celsius: "); //Take input from user $fahrenheit=(($celsius*9)/5)+32; //Calculate Fahrenheit echo("The temperature in Fahrenheit is: "); $fahrenheit=round($fahrenheit,3); echo(($fahrenheit)); //Print the value of fahrenheit ?>
When the above code is executed, it produces the following result
Enter the Celsius: 75 The temperature in Fahrenheit is: 167
Convert Celsius into Fahrenheit – JavaScript
//Code to Convert Celsius to Fahrenheit //Ask input from the user const celsius=prompt("Enter a Celsius value: "); const fahrenheit=(celsius*1.8)+32 //Caculate Fahrenheit uaing scientific equation //Display the result on the screen console.log(`${celsius} degrees Celsius is equal to ${fahrenheit } degrees Fahrenheit.` );
When the above code is executed, it produces the following result
Enter a Celsius value: 88 88 degrees Celsius is equal to 190.4 degrees Fahrenheit.
Similar post
Celsius into Fahrenheit in the C program
Fahrenheit into Celsius in C program
Celsius into Fahrenheit in C++ program
Fahrenheit into Celsius in C++ program
Celsius into Fahrenheit in the C# program
Fahrenheit into Celsius in C# program
Convert Celsius into Fahrenheit in Python
Convert Fahrenheit into Celsius in Python
Convert Celsius into Fahrenheit in PHP
Convert Fahrenheit into Celsius in PHP
Convert Celsius into Fahrenheit in JavaScript
Convert Fahrenheit into Celsius in JavaScript