-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram_4.html
More file actions
44 lines (43 loc) · 1.69 KB
/
Copy pathProgram_4.html
File metadata and controls
44 lines (43 loc) · 1.69 KB
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
<!doctype html>
<html>
<head>
<title>Program 4</title>
</head>
<body>
<input type="text" id ="str" placeholder="Enter string/Number">
<input type="submit" onclick="find();"name="sub" value="submit">
<div id="result"></div>
<script>
function find(){
var str=document.getElementById("str").value;
if(Number.isInteger(parseInt(str)))
{
var num=parseInt(str);
var rev=0,rem=0;
while(num>0){
rem=parseInt(num%10);
rev=rev*10+rem;
num=parseInt(num/10);
}
document.getElementById("result").innerHTML="<P>Reverse is : "+rev+"</p>";
}
else
{
for(var i=0;i<str.length;i++)
{
if(str.charAt(i)=='a'|| str.charAt(i)=='e' || str.charAt(i)=='i'|| str.charAt(i)=='o'|| str.charAt(i)=='u'||
str.charAt(i)=='A'|| str.charAt(i)=='E'|| str.charAt(i)=='I'||str.charAt(i)=='O'|| str.charAt(i)=='U')
{
var pos=i+1;
var text="Position of left most vowel "+str.charAt(i)+" "+pos;
document.getElementById("result").innerHTML=text;
exit;
}
}
var text="No vowel is in the string ";
document.getElementById("result").innerHTML=text;
}
}
</script>
</body>
</html>