-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvowalOrconst.html
78 lines (65 loc) · 2.09 KB
/
vowalOrconst.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<html lang="en">
<head>
<title>Conatant and Vowal</title>
</head>
<body>
<style>
.text{
color:blueviolet;
}
.box{
border: 2px solid gold;
border-radius: 5px;
}
.btn{
border-radius: 5px;
background-color: cadetblue;
}
</style>
<input type="text" id="const" class="box"><br>
<p class="text">Check weathe cherecter Vowal or Constant</p>
<button onclick="myFunction()" class="btn">Check </button><br>
<p class="text">Check weathe Armstronge or not</p>
<button onclick="myFunction2()" class="btn">Reverse </button>
<p class="text">Convert decimal to Binary</p>
<button onclick="myFunction3()" class="btn">Convert</button>
<p id="ans"></p>
<script>
function myFunction() {
var str = document.getElementById("const").value
if(str.length == 1){
console.log(str.length)
if(str==='a'||str ==='e'||str==='i'||str === 'u'||str === 'o'||str === 'O'|| str === 'I'|| str === 'A'|| str === 'E'|| str === 'U')
{
document.getElementById("ans").innerHTML = "Vowal"
}
else
{
document.getElementById("ans").innerHTML = "Constant"
}
}else{
document.getElementById("ans").innerHTML = "Enter only one cherecter"
console.log("Enter only one cherecter")
}
}
function myFunction2() {
var str = document.getElementById("const").value
var revStr = str.split('').reverse().join('')
console.log(revStr)
document.getElementById("ans").innerHTML = revStr
}
function myFunction3() {
//var str = document.getElementById("const").value
var num = 4;
var remend ,dev = 0 ;
while(num !=0){
console.log
remend = num % 2;
console.log(remend);
num = num/2;
}
}
</script>
</body>
</html>