write java script function to convert the temperature from celsius to fahrenheit. the user can enter any number, convert the number into fahrenheit, using following formula:
x=y*1.8+32
where x is the value of Fahrenheit and y us the value in Celsius. Use HTML page to enter value y and display the result
Answers
Answered by
0
function cToF(celsius)
{
var cTemp = celsius;
var cToFahr = cTemp * 9 / 5 + 32;
var message = cTemp+'\xB0C is ' + cToFahr + ' \xB0F.';
console.log(message);
}
function fToC(fahrenheit)
{
var fTemp = fahrenheit;
var fToCel = (fTemp - 32) * 5 / 9;
var message = fTemp+'\xB0F is ' + fToCel + '\xB0C.';
console.log(message);
}
cToF(60);
fToC(45);
Similar questions