-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #476 from ut-code/update-sample-scripts
Update sample scripts
- 2024-10-01
- 2024-06-11
- 2024-06-04
- 2024-05-21
- 2024-05-14
- 2024-05-05
- 2024-05-04
- 2024-05-03
- 2024-04-27
- 2024-04-19
- 2024-04-14
- 2024-04-11
- 2024-04-09
- 2023-12-21
- 2023-12-16
- 2023-12-14
- 2023-12-07
- 2023-11-30
- 2023-11-16
- 2023-11-16-2
- 2023-11-09
- 2023-11-09-3
- 2023-11-09-2
- 2023-11-02
- 2023-10-26
- 2023-10-26-2
- 2023-10-22
- 2023-10-19
Showing
5 changed files
with
13 additions
and
17 deletions.
There are no files selected for viewing
8 changes: 4 additions & 4 deletions
8
docs/1-trial-session/08-loop/_samples/is-prime-using-and/script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
const n = 89; //任意の整数 | ||
const n = 89; // 任意の整数 | ||
|
||
let isPrime = true; | ||
if (n <= 1) { | ||
// nが1以下のときは素数でない | ||
isPrime = false; | ||
} | ||
|
||
for (let i = 2; i < n; i += 1) { | ||
// nが1以下のときは素数でない | ||
isPrime = isPrime && n % i != 0; | ||
} | ||
|
||
if (isPrime) { | ||
document.write(`${n} は素数です。`); | ||
document.write(`${n} は素数です`); | ||
} else { | ||
document.write(`${n} は素数ではありません。`); | ||
document.write(`${n} は素数ではありません`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
let product = 1; | ||
|
||
for (let i = 1; i <= 10; i += 1){ | ||
for (let i = 1; i <= 10; i += 1) { | ||
product *= i; | ||
} | ||
|
||
document.write(product); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
let product = 1; | ||
|
||
for (i = 1; i <= 10; i = i + 1) { | ||
for (let i = 1; i <= 10; i = i + 1) { | ||
product = product * i; | ||
} | ||
|
||
document.write(product); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters