Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class ReverseMultiplicationTable {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- String numberString = input.nextLine();
- if (numberString.length() == 3 && !numberString.contains("-") && !numberString.contains("0")) {
- char digit3 = numberString.charAt(0);
- char digit2 = numberString.charAt(1);
- char digit1 = numberString.charAt(2);
- for (int i = 1; i <= Integer.parseInt(String.valueOf(digit3)); i++) {
- for (int j = 1; j <= Integer.parseInt(String.valueOf(digit2)); j++) {
- for (int k = 1; k <= Integer.parseInt(String.valueOf(digit1)); k++) {
- int product = i * j * k;
- System.out.println(i + " * " + j + " * " + k + " = " + product);
- }
- }
- }
- } else {
- System.out.println("invalid input number!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement