Advertisement
SUni2020

06. Multiplication Table

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