629
In this article we will convert from celsius to fahrenheit
The formula is
fahrenheit = (celsius * 1.8) + 32
Example 1
This will prompt a user for input
The value is stored in a constant called celsius, then we convert it and display both the values
// program to convert celsius to fahrenheit // ask for the celsius value from 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.`);
When you run this you will see something like this
20 degree celsius is equal to 68 degree fahrenheit.