...

/

Solution Review: Multiplication Table of a Number

Solution Review: Multiplication Table of a Number

In this review, the solution of the challenge 'Multiplication Table of a Number' from the previous lesson is provided.

We'll cover the following...

Solution #

Press + to interact
class MultiplicationTable {
public static String test(int num) {
int i = 1;
String answer = "";
int table;
while (i <= 10) {
table = num * i;
answer += String.valueOf(table) + " ";
i++;
}
return answer;
}
public static void main( String args[] ) {
System.out.println(test(5));
}
}

Explanation

To calculate the table of the given number, we will multiply the given number with 1 ...