that assignment was fun

This commit is contained in:
2023-03-24 13:22:50 -05:00
parent 0782b2c775
commit bbce21cf8b
11 changed files with 204 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
-->
<html>
<head>
<title>NUMBER ROUNDER</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
var input = prompt("Enter a number.");
var decimal = input - Math.trunc(input);
var output;
if (decimal > .5) {
output = Math.trunc(input) + 1;
var round = "up";
} else {
output = Math.trunc(input);
var round = "down";
}
document.write(input + " rounded " + round + " is " + output);
</script>
</head>
</html>