Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 79c0599

Browse files
Loops
1 parent f91d5d8 commit 79c0599

File tree

3 files changed

+96
-2
lines changed

3 files changed

+96
-2
lines changed

‎ForLoops/app.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
//For Loop ? Some Work we are doing for some of times which we want
2+
3+
//Syntax :
4+
// 1. Variable
5+
// 2. Condition (How much time loop Run)
6+
// 3. Increament or Decreament
7+
8+
for(let i = 0 ; i <= 7 ; i++){
9+
console.log(i + "Run");
10+
}
11+
12+
//Multiplication Table
13+
14+
// for(let j = 1 ; j <= 20 ; j++){
15+
// console.log("2 X "+ j + " = " + 2*j);
16+
17+
// }
18+
19+
//Multiplication Table From User
20+
21+
let tableNumber = prompt("Enter Table Number");
22+
let times = prompt("How Many Times Table Run");
23+
24+
for(let j = 1 ; j <= times ; j++){
25+
console.log(tableNumber + " X " + j + " = " + tableNumber*j);
26+
27+
}
28+
29+
document.write(" <h4>Q1. Square from 1 to 10</h4>")
30+
for (var k = 1; k <= 10; k++) {
31+
document.write(`<li>${k * k}</li>`)
32+
}
33+
34+
document.write(` <h4>Q2. Find largest number from this
35+
Array [ 0 , 30 , 10 , 31 , 42 , 22 , 144 , 21 , 42 ]</h4>`)
36+
var arr = [0, 30, 10, 31, 42, 22, 144, 21, 42]
37+
var largestNumber = 0
38+
39+
for (var l = 0; l < arr.length; l++) {
40+
if (arr[l] > largestNumber) {
41+
largestNumber = arr[l]
42+
}
43+
}
44+
document.write(`<p>Largest number is <b>${largestNumber}</b> </p>`)
45+
46+
document.write(` <h4>Q2. Find Smallest number from this
47+
Array [ 6 , 30 , 2 , 31 , 42 , -2 , 144 , -5 , 42 ]</h4>`)
48+
var arr = [6, 30, 2, 31, 42, -2, 144, -5, 42]
49+
50+
var smallestNumber = arr[0]
51+
52+
for (var m = 0; m < arr.length; m++) {
53+
if (arr[m] < smallestNumber) {
54+
smallestNumber = arr[m]
55+
}
56+
}
57+
document.write(`<p>Smallest number is <b>${smallestNumber}</b> </p>`)
58+
59+
document.write(` <h4>Q3. Print number like this ,
60+
1
61+
123
62+
1234
63+
12345
64+
123456 .... So On </h4>`)
65+
66+
var numString = ''
67+
for (var n = 1; n <= 20; n++) {
68+
numString = numString + n
69+
document.write(`<li>${numString}</li>`)
70+
}

‎ForLoops/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>For Loops</title>
7+
</head>
8+
<body>
9+
<h1 style="text-align: center;">Check Console Please ( Ctrl + Shift + i )</h1>
10+
<script src="app.js"></script>
11+
</body>
12+
</html>

‎Index.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<link rel="shortcut icon" href="images/java-script.png" type="image/x-icon">
1010
</head>
1111
<body>
12-
<h1 class="text-center h1 text-3xl font-bold cursor-pointer">Basic To Advanced Javascript </h1>
13-
<div class="main">
12+
<h1 class="text-center h1 text-3xl font-bold cursor-pointer mt-10 ">Basic To Advanced Javascript </h1>
13+
<div class="main flex text-center mt-10">
1414
<div class="max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700">
1515
<a href="#">
1616
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Arthimetic Operator</h5>
@@ -47,6 +47,18 @@ <h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white"
4747
</svg>
4848
</a>
4949
</div>
50+
<div class="max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700">
51+
<a href="#">
52+
<h5 class="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">For Loop</h5>
53+
</a>
54+
<p class="mb-3 font-normal text-gray-700 dark:text-gray-400">Here are the biggest enterprise technology acquisitions of 2021 so far, in reverse chronological order.</p>
55+
<a href="ForLoops/index.html" class="inline-flex items-center px-3 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
56+
Read more
57+
<svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">
58+
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5h12m0 0L9 1m4 4L9 9"/>
59+
</svg>
60+
</a>
61+
</div>
5062
</div>
5163

5264
</body>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /