Skip to content

Commit b787629

Browse files
author
abdul rafay
committed
complete Second projent
1 parent 0c9a71c commit b787629

File tree

3 files changed

+122
-14
lines changed

3 files changed

+122
-14
lines changed

Second project/index.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,16 @@
3131

3232
<!-- real project -->
3333

34-
34+
<div id="main">
35+
<div id="container">
36+
<h1>Prime Number checker</h1>
37+
<input type="number" id="numberInput" placeholder="Enter a number">
38+
39+
<button onclick="CheckPrimeNumber()">Check</button>
40+
41+
<p id="result"></p>
42+
</div>
43+
</div>
3544

3645

3746

Second project/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
function CheckPrimeNumber() {
2+
var num = Number(document.getElementById("numberInput").value);
3+
var result = document.getElementById("result");
4+
if (num <= 1) {
5+
result.textContent = "Not a prime number";
6+
} else {
7+
var isPrime = true;
8+
for (var i = 2; i < num; i++) {
9+
if (num % i === 0) {
10+
isPrime = false;
11+
break;
12+
}
13+
}
14+
15+
if (isPrime) {
16+
result.textContent = "Prime number";
17+
} else {
18+
result.textContent = "Not a prime number";
19+
}
20+
}
21+
}

Second project/style.css

Lines changed: 91 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,100 @@
4646
/* hover effects */
4747

4848
#icon:hover {
49-
transform: scale(1.2);
50-
}
49+
transform: scale(1.2);
50+
}
51+
52+
.nav-links>li>a:hover {
53+
color: #2563eb;
54+
}
55+
56+
.logo:hover {
57+
color: #000000;
58+
cursor: pointer;
59+
}
60+
61+
body {
62+
background-color: #000000;
63+
}
64+
65+
/* main work */
66+
67+
68+
#main {
69+
/* width: 100%; */
70+
display: flex;
71+
justify-content: center;
72+
align-items: center;
73+
margin-top: 150px;
74+
}
75+
76+
#container {
77+
border-radius: 20px;
78+
height: 400px;
79+
width: 500px;
80+
margin: auto;
81+
text-align: center;
82+
margin-top: 100px;
83+
color: #090000;
84+
background-color: #ffffff;
85+
}
86+
5187

52-
.nav-links>li>a:hover {
53-
color: #2563eb;
54-
}
5588

56-
.logo:hover {
57-
color: #000000;
58-
cursor: pointer;
59-
}
89+
#container>h1 {
90+
/* margin-top: 30px; */
91+
padding-top: 30px;
92+
padding-bottom: 30px;
93+
font-size: 3em;
94+
margin-bottom: 20px;
95+
color: #2563eb;
96+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
97+
font-weight: 700;
98+
99+
}
100+
101+
input[type="number"] {
102+
margin-right: 10px;
103+
height: 40px;
104+
width: 300px;
105+
font-size: 1.5em;
106+
border-radius: 5px;
107+
text-align: center;
108+
margin-bottom: 20px;
109+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
110+
font-weight: 600;
111+
112+
113+
}
114+
115+
input:focus {
116+
outline: none;
117+
border: 2px solid #2563eb;
118+
color: #2563eb;
119+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
120+
font-weight: 600;
121+
}
60122

61-
body {
62-
background-color: #000000;
63-
}
64123

65-
/* main work */
124+
button {
125+
padding: 16px;
126+
text-align: center;
127+
align-items: center;
128+
justify-content: center;
129+
height: 48px;
130+
width: 100px;
131+
font-size: 1.2em;
132+
border-radius: 5px;
133+
background-color: #2563eb;
134+
color: #ffffff;
135+
cursor: pointer;
136+
font-weight: 700;
137+
transition: all ease-in-out 0.3s;
138+
}
66139

140+
p {
141+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
142+
font-size: 1.5em;
143+
margin-top: 20px;
144+
font-weight: 600;
67145

0 commit comments

Comments
 (0)