From 421897ecff26a9ec096462a1174d926d94ebf141 Mon Sep 17 00:00:00 2001 From: zanninso <47645687+zanninso@users.noreply.github.com> Date: Tue, 23 Apr 2024 00:48:31 +0100 Subject: [PATCH] CON-2533-Markdown-Multiplication-Table-exercise (#2521) * docs: adding subject * docs: fixing format * docs: fix minor typos --------- Co-authored-by: amine --- .../multiplication-table/README.md | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 subjects/java/checkpoints/multiplication-table/README.md diff --git a/subjects/java/checkpoints/multiplication-table/README.md b/subjects/java/checkpoints/multiplication-table/README.md new file mode 100644 index 000000000..2581d193a --- /dev/null +++ b/subjects/java/checkpoints/multiplication-table/README.md @@ -0,0 +1,45 @@ +## MultiplicationTable + +### Instructions + +In a file named `MultiplicationTable.java` write a function `generate` which takes a number as a parameter, and prints the multiplication table for this number. + +### Expected Functions + +```java +public class MultiplicationTable { + public static void generate(int num) { + // your code here + } +} +``` + +### Usage + +Here is a possible `ExerciseRunner.java` to test your function : + +```java +public class ExerciseRunner { + public static void main(String[] args) { + MultiplicationTable.generate(5); + } +} +``` + +and its output : + +```shell +$ javac *.java -d build +$ java -cp build ExerciseRunner +5 x 1 = 5 +5 x 2 = 10 +5 x 3 = 15 +5 x 4 = 20 +5 x 5 = 25 +5 x 6 = 30 +5 x 7 = 35 +5 x 8 = 40 +5 x 9 = 45 +5 x 10 = 50 +$ +```