mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-09-24 23:01:18 +08:00
fix(curriculum): rename multiplesOf3And5 to multiplesOf3Or5 (#52878)
This commit is contained in:
@@ -93,6 +93,10 @@
|
||||
{
|
||||
"source": "/learn/responsive-web-design/applied-visual-design/adjust-the-size-of-a-header-versus-a-paragraph-tag",
|
||||
"destination": "/learn/responsive-web-design/applied-visual-design/adjust-the-size-of-a-heading-element-versus-a-paragraph-element"
|
||||
},
|
||||
{
|
||||
"source": "/learn/project-euler/project-euler-problems-1-to-100/problem-1-multiples-of-3-and-5",
|
||||
"destination": "/learn/project-euler/project-euler-problems-1-to-100/problem-1-multiples-of-3-or-5"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"challengeOrder": [
|
||||
{
|
||||
"id": "5900f36e1000cf542c50fe80",
|
||||
"title": "Problem 1: Multiples of 3 and 5"
|
||||
"title": "Problem 1: Multiples of 3 or 5"
|
||||
},
|
||||
{
|
||||
"id": "5900f36e1000cf542c50fe81",
|
||||
|
||||
-73
@@ -1,73 +0,0 @@
|
||||
---
|
||||
id: 5900f36e1000cf542c50fe80
|
||||
title: 'Problem 1: Multiples of 3 and 5'
|
||||
challengeType: 1
|
||||
forumTopicId: 301722
|
||||
dashedName: problem-1-multiples-of-3-and-5
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
|
||||
|
||||
Find the sum of all the multiples of 3 or 5 below the provided parameter value `number`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`multiplesOf3and5(10)` should return a number.
|
||||
|
||||
```js
|
||||
assert(typeof multiplesOf3and5(10) === 'number');
|
||||
```
|
||||
|
||||
`multiplesOf3and5(49)` should return 543.
|
||||
|
||||
```js
|
||||
assert.strictEqual(multiplesOf3and5(49), 543);
|
||||
```
|
||||
|
||||
`multiplesOf3and5(1000)` should return 233168.
|
||||
|
||||
```js
|
||||
assert.strictEqual(multiplesOf3and5(1000), 233168);
|
||||
```
|
||||
|
||||
`multiplesOf3and5(8456)` should return 16687353.
|
||||
|
||||
```js
|
||||
assert.strictEqual(multiplesOf3and5(8456), 16687353);
|
||||
```
|
||||
|
||||
`multiplesOf3and5(19564)` should return 89301183.
|
||||
|
||||
```js
|
||||
assert.strictEqual(multiplesOf3and5(19564), 89301183);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function multiplesOf3and5(number) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
multiplesOf3and5(1000);
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
const multiplesOf3and5 = (number) => {
|
||||
var total = 0;
|
||||
|
||||
for(var i = 0; i < number; i++) {
|
||||
if(i % 3 == 0 || i % 5 == 0) {
|
||||
total += i;
|
||||
}
|
||||
}
|
||||
return total;
|
||||
};
|
||||
```
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
---
|
||||
id: 5900f36e1000cf542c50fe80
|
||||
title: 'Problem 1: Multiples of 3 or 5'
|
||||
challengeType: 1
|
||||
forumTopicId: 301722
|
||||
dashedName: problem-1-multiples-of-3-or-5
|
||||
---
|
||||
|
||||
# --description--
|
||||
|
||||
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
|
||||
|
||||
Find the sum of all the multiples of 3 or 5 below the provided parameter value `number`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`multiplesOf3Or5(10)` should return a number.
|
||||
|
||||
```js
|
||||
assert(typeof multiplesOf3Or5(10) === 'number');
|
||||
```
|
||||
|
||||
`multiplesOf3Or5(49)` should return 543.
|
||||
|
||||
```js
|
||||
assert.strictEqual(multiplesOf3Or5(49), 543);
|
||||
```
|
||||
|
||||
`multiplesOf3Or5(1000)` should return 233168.
|
||||
|
||||
```js
|
||||
assert.strictEqual(multiplesOf3Or5(1000), 233168);
|
||||
```
|
||||
|
||||
`multiplesOf3Or5(8456)` should return 16687353.
|
||||
|
||||
```js
|
||||
assert.strictEqual(multiplesOf3Or5(8456), 16687353);
|
||||
```
|
||||
|
||||
`multiplesOf3Or5(19564)` should return 89301183.
|
||||
|
||||
```js
|
||||
assert.strictEqual(multiplesOf3Or5(19564), 89301183);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function multiplesOf3Or5(number) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
multiplesOf3Or5(1000);
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
const multiplesOf3Or5 = (number) => {
|
||||
var total = 0;
|
||||
|
||||
for(var i = 0; i < number; i++) {
|
||||
if(i % 3 == 0 || i % 5 == 0) {
|
||||
total += i;
|
||||
}
|
||||
}
|
||||
return total;
|
||||
};
|
||||
```
|
||||
@@ -3,7 +3,7 @@ const challenges = {
|
||||
'/learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements',
|
||||
rosettaCode: '/learn/rosetta-code/rosetta-code-challenges/100-doors',
|
||||
projectEuler:
|
||||
'/learn/project-euler/project-euler-problems-1-to-100/problem-1-multiples-of-3-and-5'
|
||||
'/learn/project-euler/project-euler-problems-1-to-100/problem-1-multiples-of-3-or-5'
|
||||
};
|
||||
|
||||
const social = {
|
||||
|
||||
Reference in New Issue
Block a user