Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TDDebogage
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BARRE Milo
TDDebogage
Commits
0f1bd24a
Commit
0f1bd24a
authored
1 week ago
by
BARRE Milo
Browse files
Options
Downloads
Patches
Plain Diff
Exercice 8
parent
883201ad
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
compte-rendu.txt
+10
-1
10 additions, 1 deletion
compte-rendu.txt
ex8.ts
+34
-0
34 additions, 0 deletions
ex8.ts
with
44 additions
and
1 deletion
compte-rendu.txt
+
10
−
1
View file @
0f1bd24a
...
@@ -58,4 +58,13 @@ Exercice 7 :
...
@@ -58,4 +58,13 @@ Exercice 7 :
return x * y; // Solution optimale
return x * y; // Solution optimale
}
}
6. Programme : voir ex7.ts
6. Programme : voir ex7.ts
\ No newline at end of file
Exercice 8 :
fonction multiplication modifiée :
function multiplication(x: number, y: number): number {
return x * y;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
ex8.ts
0 → 100644
+
34
−
0
View file @
0f1bd24a
let
n
=
5
;
console
.
log
(
deb8
(
n
));
function
deb8
(
n
:
number
):
number
{
if
(
n
===
0
){
return
1
}
let
valeur
=
n
*
deb8
(
n
-
1
);
return
valeur
;
}
const
testCases
=
[
[
0
,
0
],
[
5
,
3
],
[
3
,
5
],
[
-
5
,
-
2
],
[
-
2
,
-
5
],
[
-
74
,
2
],
[
-
1
,
75
],
[
10
,
-
25
],
[
10
,
-
3
]
];
testCases
.
forEach
(([
x
,
y
])
=>
{
console
.
log
(
`multiplication(
${
x
}
,
${
y
}
) =
${
multiplication
(
x
,
y
)}
`
);
});
function
factorial
(
n
:
number
):
number
{
if
(
n
<
0
)
throw
new
Error
(
"
n must be >= 0
"
);
let
result
=
1
;
for
(
let
i
=
2
;
i
<=
n
;
i
++
)
result
*=
i
;
return
result
;
}
function
multiplication
(
x
:
number
,
y
:
number
):
number
{
return
x
*
y
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment