-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloop.html
55 lines (46 loc) · 1.2 KB
/
loop.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
let i = 0;
// for(i=1;i<=100;i+=2){
// console.log(i);
// }
// while(i<=10){
// console.log(i)
// i+=2
// }
// do{
// console.log(i);
// i+=2
// }
// while(i<=20)
// Problem Statement
// Write a program that prints the numbers from 1 to 100.
// For multiples of 3, print "Fizz" instead of the number.
// For multiples of 5, print "Buzz" instead of the number.
// For numbers that are multiples of both 3 and 5, print "FizzBuzz."
let n;
for(n=1;n<=100;n++){
if(n % 3==0 && n % 5==0)
{
console.log("FizzBuzz");
}
else if(n%3 == 0){
console.log("Fizz");
}
else if(n%5 == 0){
console.log("Buzz");
}
else{
console.log(n)
}
}
</script>
</body>
</html>