forked from Minskoleopc/javascript830B
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script12.js
73 lines (55 loc) · 1.38 KB
/
script12.js
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
// // 0 1 2 3
// let birthYear = [1999,2000,2001,2002]
// // [25,24,23,22]
// let ages = [] // [25]
// for(let i = 0 ; i < 4; i++){
// //console.log(i)
// //console.log(birthYear[i])
// //console.log(2024 - birthYear[i])
// let a = 2024 - birthYear[i]
// ages.push(a)
// }
// console.log(ages)
// let birthYear = [1989,1990,1991,1992]
// let ages = []
// //[35,34,33,32]
// for(let i = 0 ; i < birthYear.length ; i++){
// //console.log(i)
// //console.log(birthYear[i])
// //console.log(2024 - birthYear[i])
// let b = 2024 - birthYear[i]
// ages.push(b)
// }
// console.log(ages)
// program 2
let marks = [77,55,66,77,88]
let aboveE75 = []
//[77,77,88]
for(let i = 0 ; i < marks.length ; i++){
// console.log(i)
// console.log(marks[i])
if(marks[i] >= 75){
aboveE75.push(marks[i])
}
}
console.log(aboveE75)
// program 3
let cities = ["pune","mumbai","nagpur"]
for(let i = 0 ; i < cities.length ; i++){
//console.log(i)
//console.log(cities[i])
console.log("welcome "+cities[i])
}
// program 4
let numbers = [11,22,33]
// 66
let total = 0
for(let i = 0 ; i < numbers.length ; i++){
//console.log(i)
//console.log(numbers[i])
total = total + numbers[i]
// 0 + 11 // 11
// 11 + 22 // 33
// 33 + 33 // 66
}
console.log(total)