TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

Program to convert Celsius into Fahrenheit

Program to convert Celsius into Fahrenheit on fibonacci, factorial, prime, armstrong, swap, reverse, search, sort, stack, queue, array, linkedlist, tree, graph etc.

<< Back to PROGRAM

Program to convert Celsius into Fahrenheit

Explanation

Fahrenheit and Celsius are the measures of temperature having Unit in degrees as oF

oC respectively. In this tutorial, we have to convert Celsius to Fahrenheit by using the scientific formula in programmes of different languages.

Formula

T(oF)   =  (T(oC)   ×  (9/5)) + 32

Algorithm

  1. Define temperature in Celsius unit.
  2. Apply in the formula.
  3. Print the temperature in Fahrenheit.

Complexity

O(1)


Solution

Python

celsius= 12
fahrenheit= ((celsius*9)/5)+32
print("Temperature in Fahrenheit is: ");
print(fahrenheit); 

Output:

Temperature in Fahrenheit is: 53.6

C

#include<stdio.h>
                   int main() 
                   { 
                   float fahrenheit, celsius;
		           celsius = 24;
                   fahrenheit =( (celsius*9)/5)+32;
		           printf("\n\n Temperature in fahrenheit is:  %f",fahrenheit);
                       return (0);
    }

Output:

Temperature in fahrenheit is: 75.1999997

JAVA

public class temperature
 {
   public static void main (String args[])
	{ float Fahrenheit, Celsius;
          Celsius= 13;
          Fahrenheit =((Celsius*9)/5)+32;
          System.out.println("Temperature in Fahrenheit is: "+Fahrenheit);
	}}

Output:

Temperature in Fahrenheit is: 55.4

C#

using System;
class main
{   static void Main() 
    {
         float fahrenheit, celsius;
          celsius= 13;
          fahrenheit =((celsius*9)/5)+32;
       Console.WriteLine("Temperature in Fahrenheit is: "+fahrenheit);
    }}

Output:

Temperature in Fahrenheit is: 55.4

PHP

<?php
       $celsius = 17 ;
       $fahrenheit = (($celsius*9)/5)+32 ; 
       echo("Temperature in Fahrenheit is:  ");
       echo($fahrenheit);
?>

Output:

Temperature in Fahrenheit is:  62.6

Next Topic#




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf