-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcycle.js
More file actions
47 lines (39 loc) · 1.17 KB
/
cycle.js
File metadata and controls
47 lines (39 loc) · 1.17 KB
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
// let sum = 0;
// while (true) {
// let value = +prompt("Введите число", '')
// if (!value) break; // (*)
// sum += value;
// }
// alert( 'Сумма: ' + sum );
// for (let i = 0; i < 10; i++) {
// // если true, пропустить оставшуюся часть тела цикла
// if (i % 2 == 0) continue;
// alert(i); // 1, затем 3, 5, 7, 9
// }
// let i = 0;
// while (i++ < 5) alert( i );
// for (let i = 1; i <= 10; i++){
// if (i % 2 != 0) continue;
// alert(i);
// }
// let i = 0;
// while (i < 3){
// alert(`number ${i}!`);
// i++;
// }
// while (true){
// let i = prompt('Введите число большее 100...','');
// if (i > 100 || i == undefined) break;
// }
// let i;
// do {
// i = prompt('Введите число большее 100...','');
// }while(i <= 100 && i);
let n = 100;
nextPrime:
for (let i = 2; i <= n; i++) { // Для всех i...
for (let j = 2; j < i; j++) { // проверить, делится ли число..
if (i % j == 0) continue nextPrime; // не подходит, берём следующее
}
alert(i); // простое число
}