-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask7.html
41 lines (39 loc) · 1.43 KB
/
task7.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Task-7</title>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
</head>
<body>
<div class="row">
<div class="col-3">
</div>
<div class="d-flex justify-content-center bg-warning m-5 col-5 ">
<div class="justify-content-center">
<h1>Number Reversing</h1><br>
<label for="rev">Enter a number to reverse:- </label>
<input class="form-group bg-light"id="num" style="border: 1px solid black; border-radius: 5px;" name="rev" type="number"><br>
<input class="form-group btn btn btn-danger btn-block" type="submit" onclick="revnum()">
</div>
</div>
</div>
<div class="row">
<div class="col-5">
</div>
<div class="col-2 justify-content-center" id="result-container">
</div>
</div>
<script>
function revnum() {
const num=document.getElementById("num").value
const numStr = num.toString();
const reversedStr = numStr.split('').reverse().join('');
const reversedNum = parseInt(reversedStr, 10);
var resultContainer = document.getElementById("result-container");
resultContainer.innerHTML = `Reversed Value: ${reversedNum}`;
}
</script>
</body>
</html>