Answer to Question #254147 in Java | JSP | JSF for kitty ku

Question #254147
Write a Java program that prompts the user to enter the number they wish
to see the multiplication table of. In addition, the program should prompt
the user to enter the length of multiplication table (i.e. counter) and
displays the table on the screen.
1
Expert's answer
2021-10-20T23:55:28-0400
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("Number: ");
        int number = in.nextInt();
        System.out.print("Length: ");
        int length = in.nextInt();
        for (int i = 1; i <= length; i++) {
            System.out.println(number + " * " + i + " = " + number * i);
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS