Programming with JavaScript

⌘K
  1. Home
  2. Docs
  3. Programming with JavaScri...
  4. Practice Programs
  5. Convert temperatures to and from Celsius – Fahrenheit.

Convert temperatures to and from Celsius – Fahrenheit.

Example: 1A

Write a JavaScript to convert temperatures to and from celsius, Fahrenheit.

Script

let temperature = 23;
let F = (temperature * 9) / 5 + 32;
console.log("Fahrenheit=" + F);

let C = ((F - 32) * 5) / 9;
console.log("celcius=" + C);

Output

Loading

Views: 15

How can we help?

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments