4.13 Multiplication Table
When kids are learning the multiplication tables they need to repeat several times the multiplication tables. In this lab you are requested to write a lab that will ask for an integer number and will show the table multiplying that number from 0 to 10. As an example, if the user inputs the number "3" the program will have the output as shown next. Without using printf and in java.
3 x 0 = 0 3 x 1 = 3 3 x 2 = 6 3 x 3 = 9 3 x 4 = 12 3 x 5 = 15 3 x 6 = 18 3 x 7 = 21 3 x 8 = 24 3 x 9 = 27 3 x 10 = 30 3 x 11 = 33 3 x 12 = 36 3 x 13 = 39 3 x 14 = 42 3 x 15 = 45 3 x 16 = 48 3 x 17 = 51 3 x 18 = 54 3 x 19 = 57 3 x 20 = 60
//TestCode.java import java.util.Scanner; public class TestCode { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n; System.out.print("Enter an integer: "); n = scanner.nextInt(); for(int i = 0;i<=20;i++){ System.out.println(n+" x "+i+" = "+(n*i)); } } }
Get Answers For Free
Most questions answered within 1 hours.