celcius converter

by jasonvee

JavaScript

//get user input
var celsius = prompt('Enter degrees celsius: ');

//convert user input to an integer (number) 
// not crucial in js for small programs, but good to know the data type
celsius = parseInt(celsius);

//add formula to convert celcius to fahrenheit
var fahrenheit = (celsius * 9/5 ) + 32;

//convert again - from integer to a string
celsius = celsius.toString();
fahrenheit = fahrenheit.toString();

//output concatenation
document.write('You entered ' + celsius + ' degrees celsius, which is ' + ' degrees ' + fahrenheit + ' fahrenheit');