-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
75 lines (67 loc) · 2.68 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Lowongan | Bilangan Prima</title>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm-2 col-md-2 col-lg-2"></div>
<div class="col-sm-4 col-md-4 col-lg-4">
<br>
<form>
<div class="form-group">
<label for="number">Nomor</label>
<input type="number" min="1" max="100" class="form-control" id="number" maxlength="3">
</div>
<button type="button" class="btn btn-default">Submit</button>
</form>
<br>
<div id="result">
Result Will Be Shown Here :
<br><span></span>
</div>
</div>
<div class="col-sm-2 col-md-2 col-lg-2"></div>
</div>
</div>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/popper.min.js?v=00"></script>
<script src="js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
var num = $("#number").val();
if(num < 1 && num > 100){
alert("Range nomor 1 - 100 Saja");
}
else {
var str = "";
for(i=1; i<=num; i++){
if(i==1 && num==1){
str = "Tidak ada bilangan Prima";
}
else if(i==2){
str = str+" "+i;
}else if(i!=1){
var check = true;
for(j=2; j<i; j++){
if(i%j==0){
check = false;
break;
}
}
if(check != false){
str = str+" "+i;
}
}
}
str = str+"<br>Hire Me, Please :)";
$("#result span").html(str);
}
});
});
</script>
</body>
</html>