In this tutorial, we will discuss the concept of the Program for Celsius into Fahrenheit conversions
In this post, we will learn how to write a program to convert Celsius into Fahrenheit using the function of different programming languages with an Example program.
Temperature and conversion
Generally, We have known three types of temperature units Fahrenheit, Celsius, and Kelvin. This article describes how to convert temperature units Celsius into Fahrenheit using different programming languages. Fahrenheit and Celsius are the measuring units in degrees as 0F and 0C respectively.
scientific equation Fahrenheit= Celsius*9/5+32
In this program, the user declares a double variable as a parameter for Celsius(c) in the user-defined function. When the user calls the function, The program asks to enter a value for Cesius and the Celsius value passes to the function as an argument through the variable.
Finally, the Fahrenheit value is calculated and displayed using different programming languages’ functions on the screen.
Program 1
//Java program to Convert Celsius into Fahrenheit import java.util.Scanner; public class Celsius_InTo_Fahrenheit { public static void main (String args[]){ //variables declaration of Fahrenheit and Celsius as double double fahrenheit,celsius; Scanner input=new Scanner(System.in); //Scanner object System.out.print("Input value to Celsius: "); //Take input from uxer celsius=input.nextDouble(); fahrenheit=(celsius*9/5)+32; //Calculate Fahrenheit value using given Celsius value System.out.print("Temperature in Farhenheit:"+fahrenheit); //print the fahrenheit value } }
When the above code is executed, it produces the following result
Input value to Celsius: 100 Temperature in Farhenheit:212.0
Program 2
//Celsius into Fahrenheit convertion program in C //Entered by user #include <stdio.h> int main() { //float type variables declaration float celsius,fahrenheit; //Ask input for variables printf("Enter tempereature in Celsius :"); scanf("%f",&celsius);//Reading the input //Convert celsius to fahrenheit fahrenheit=((celsius*9/5)+32); printf("%.2f Celsius is=%.2f Fahrenheit ",celsius,fahrenheit); //Dispay fahrenheit value on the screen return 0; }
When the above code is executed, it produces the following result
Enter temperature in Celsius:36.9 36.90 Celsius is=98.42 Fahrenheit
Program 2
//C++ program to convert C into f from user input #include <iostream> using namespace std; int main() { float celsius, fahrenheit; //float type variables declaration // take input from the user for cesius cout<<"Enter the temperature in Celsius:"; cin>>celsius;//reading the input //Calculate fahrenheit using 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:90 90 Celsius is the same to 194 Fahrenheit
Program 4
// Celsius to Fahrenheit to convertion program in C# using System; namespace temperature { public class CelstoFahr { public static void Main(string[] args) { double celsius,fahrenheit; //Declare variables as double Console.WriteLine ("Enter temperature in Celsius: "); //Ask input from user celsius=Convert.ToDouble(Console.ReadLine()); //Reading the input //initialize value to Celsius fahrenheit=(1.8*celsius)+32; //Calculate Fahrenheit using scientific equation Console.WriteLine ("The temperature in Fahrenheit: "+fahrenheit); //Display result Console.ReadKey(); } } }
When the above code is executed, it produces the following result
Enter temperature in Celsius: 20 The temperature in Fahrenheit: 68
Program 5
#Program to convert temperature in Celsius to Fahrenheit in Python celsius=float(input("Enter temperature in Celsius ")) #Take input from the user #Calculate Fahrenheit using given Celsius 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 37.0 37.0 degree Celsius is equal to 98.6 degrees Fahrenheit
Program 6
<?php //php code to convert Celsius to Fahrenheit $celsius=readline("Enter the Celsius: "); //Take input from user $fahrenheit=(($celsius*9)/5)+32; //Calculate temperature in 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: 100 The temperature in Fahrenheit is: 212
Program 7
//program to Convert Celsius to Fahrenheit //Takes the celsius value from the user const celsius=prompt("Enter a Celsius value: "); const fahrenheit=(celsius*1.8)+32 //Caculate Fahrenheit uaing given celsius value console.log(`${celsius} degrees Celsius is equal to ${fahrenheit } degrees Fahrenheit.` ); //Display the result on the screen
When the above code is executed, it produces the following result
Enter a Celsius value: 0.0
0.0 degrees Celsius is equal to 32 degrees Fahrenheit.
Similar post
Code to convert Fahrenheit into Celsius using the Java
Code to convert Celsius into Fahrenheit using the Java
Java program to convert Fahrenheit into Celsius using the method
Java program to convert Celsius into Fahrenheit using the method
Code to convert Fahrenheit into Celsius using the C Language
Code to convert Celsius into Fahrenheit using the C Language
C program to convert Fahrenheit into Celsius using the function
C program to convert Celsius into Fahrenheit using the function
Code to convert Fahrenheit into Celsius using the C++ Language
Code to convert Celsius into Fahrenheit using the C++ Language
C++ code to convert Fahrenheit into Celsius using the function
C++ code to convert Celsius into Fahrenheit using the function
C# inverted full pyramid star pattern In this article, we will discuss the concept of…
C# Full Pyramid star pattern program In this article, we will discuss the concept of…
Program to count vowels, consonants, words, characters and space in Java In this article, we…
How to print multiplication table using Array in C++ language In this post, we will…
C Program to multiplication table using Array In this tutorial , we will discuss about…
Java program to check odd or even using recursion In this tutorial, we discuss a…