0% found this document useful (0 votes)
5 views2 pages

Exp 2

Uploaded by

modavir123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Exp 2

Uploaded by

modavir123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

EXPERIMENT - 2

INPUT :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Number to Words</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 50px;
text-align: center;
}

.container {
margin: 20px auto;
padding: 20px;
max-width: 400px;
border: 1px solid #ccc;
border-radius: 8px;
}

input[type="text"] {
width: 100%;
padding: 10px;
font-size: 16px;
border-radius: 5px;
border: 1px solid #ccc;
}

.result {
margin-top: 20px;
font-size: 18px;
color: #2c3e50;
font-weight: bold;
}
</style>
</head>
<body>

<div class="container">
<h2>Enter a Number (0-99)</h2>
<input type="text" id="numberInput" placeholder="Enter a number"
oninput="convertToWords()">
<p id="errorMessage" style="color: red;"></p>
<p id="result" class="result"></p>
</div>

<script>
const words = [
"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",
"eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen",
"nineteen",
"twenty", "twenty-one", "twenty-two", "twenty-three", "twenty-four", "twenty-five",
"twenty-six",
"twenty-seven", "twenty-eight", "twenty-nine", "thirty", "thirty-one", "thirty-two",
"thirty-three",
"thirty-four", "thirty-five", "thirty-six", "thirty-seven", "thirty-eight", "thirty-nine",
"forty",
"forty-one", "forty-two", "forty-three", "forty-four", "forty-five", "forty-six", "forty-
seven",
"forty-eight", "forty-nine", "fifty", "fifty-one", "fifty-two", "fifty-three", "fifty-four", "fifty-
five",
"fifty-six", "fifty-seven", "fifty-eight", "fifty-nine", "sixty", "sixty-one", "sixty-two",
"sixty-three",
"sixty-four", "sixty-five", "sixty-six", "sixty-seven", "sixty-eight", "sixty-nine",
"seventy", "seventy-one",
"seventy-two", "seventy-three", "seventy-four", "seventy-five", "seventy-six",
"seventy-seven", "seventy-eight",
"seventy-nine", "eighty", "eighty-one", "eighty-two", "eighty-three", "eighty-four",
"eighty-five", "eighty-six",
"eighty-seven", "eighty-eight", "eighty-nine", "ninety", "ninety-one", "ninety-two",
"ninety-three", "ninety-four",
"ninety-five", "ninety-six", "ninety-s

You might also like