From 6204a41afc79cce7dddec057c032554cc46974a5 Mon Sep 17 00:00:00 2001 From: Aditi Arya <66111613+aditi29400@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:24:36 +0530 Subject: [PATCH] Add files via upload --- js/script.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/js/script.js b/js/script.js index 8b13789..bafbc6f 100644 --- a/js/script.js +++ b/js/script.js @@ -1 +1,13 @@ - +let celsius = document.getElementById("celsius"); +let fahrenheit = document.getElementById("fahrenheit"); + +function celToFar(){ + let output = ( parseFloat(celsius.value) * 9/5 ) + 32; + fahrenheit.value = parseFloat(output.toFixed(2)); +} + +function farToCel(){ + let output = ( parseFloat(fahrenheit.value) - 32) * 5/9; + celsius.value = parseFloat( output.toFixed(2)); + console.log(output); +} \ No newline at end of file