Skip to content

Commit

Permalink
Simple multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
PheRum committed Jun 15, 2024
1 parent 69da647 commit d4de607
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
5 changes: 5 additions & 0 deletions 8_kyu/Simple multiplication/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Simple multiplication

https://www.codewars.com/kata/583710ccaa6717322c000105

This kata is about multiplying a given number by eight if it is an even number and by nine otherwise.
11 changes: 11 additions & 0 deletions 8_kyu/Simple multiplication/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { simpleMultiplication } from "./index";

describe("Tests", () => {
it("example", () => {
expect(simpleMultiplication(2)).toBe(16);
expect(simpleMultiplication(1)).toBe(9);
expect(simpleMultiplication(8)).toBe(64);
expect(simpleMultiplication(4)).toBe(32);
expect(simpleMultiplication(5)).toBe(45);
});
});
3 changes: 3 additions & 0 deletions 8_kyu/Simple multiplication/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function simpleMultiplication(number: number): number {
return number % 2 === 0 ? number * 8 : number * 9;
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

### Katas solved

`Total`: 95 \
`8_kyu`: 78 \
`Total`: 96 \
`8_kyu`: 79 \
`7_kyu`: 13 \
`6_kyu`: 4 \
`5_kyu`: 0 \
Expand Down
1 change: 0 additions & 1 deletion kata.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
8 kyu - Simple multiplication - https://www.codewars.com/kata/583710ccaa6717322c000105
8 kyu - Convert a String to a Number! - https://www.codewars.com/kata/544675c6f971f7399a000e79
8 kyu - CSV representation of array - https://www.codewars.com/kata/5a34af40e1ce0eb1f5000036
8 kyu - Reversed Strings - https://www.codewars.com/kata/5168bb5dfe9a00b126000018
Expand Down

0 comments on commit d4de607

Please sign in to comment.