Write a java code to create the following multiplication tab
Write a java code to create the following multiplication table (4 x 10). Line 1 of your code Must read // This program was written by \"yourName\" You will loose 2points if the line is missing in your code Hint use nested for loops.
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 6 9 12 15 18 21 24 27 30
4 8 12 16 20 24 28 32 36 40
Solution
import java.util.Scanner;
/**
* @author kumar
*
*/
public class Tester {
public static void main(String args[]){
int maxNumber=4;
// Scanner sc = new Scanner(System.in); // Uncomment this code if you want to take input maxNumber instead defining it as 4
// System.out.print(\"Enter a number till which you want to print the table : \");
// n = sc.nextInt();
for(int number = 1; number <= maxNumber; number++){ // for every number from 1 to 4(maxNumber) print the table
for(int j = 1; j<=10 ; j++){ // for a given number, print the table
System.out.print((number* j)+\"\\t\");
}
System.out.println();
}
}
}
