Home JavaScript Example Program to Convert Celsius to Fahrenheit in JavaScript

Program to Convert Celsius to Fahrenheit in JavaScript

by anupmaurya

In this example, you’ll learn to make a Program to Convert Celsius to Fahrenheit in JavaScript.

To convert the Celsius value to Fahrenheit , the below formula is used.

fahrenheit = celsius * 1.8 + 32

Program to Convert Celsius to Fahrenheit

// ask the celsius value to the user 
const celsius = prompt("Enter a celsius value: ");

// calculate fahrenheit
const fahrenheit = (celsius * 1.8) + 32

// display the result
console.log(`${celsius} degree celsius is equal to ${fahrenheit} degree fahrenheit.`);

Output

Enter a celsius value: 55
55 degree celsius is equal to 131 degree fahrenheit.

You can convert fahrenheit value to celsius using below the formula:

celsius = (fahrenheit - 32) / 1.8

Thank you for reading, If you have reached so far, please like the article, It will encourage me to write more such articles. Do share your valuable suggestions, I appreciate your honest feedback!

You may also like

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.