Advertisement
VMatova

Multiply Table

Feb 24th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class MultiplyTable {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.         int number = Integer.parseInt(scan.nextLine());
  7.  
  8.         int firstDigit = number % 10;
  9.         int secondDigit = (number / 10) % 10;
  10.         int thirdDigit = number / 100;
  11.  
  12.         for (int first = 1; first <= firstDigit ; first++) {
  13.             for (int second = 1; second <= secondDigit ; second++) {
  14.                 for (int third = 1; third <= thirdDigit ; third++) {
  15.                     System.out.printf("%d * %d * %d = %d;%n", first, second, third, (first * second * third));
  16.                 }
  17.  
  18.             }
  19.            
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement