desislava_topuzakova

11. Multiplication Table 2.0

Sep 16th, 2021
1,085
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class MultiplicationTable {
  4.     public static void main(String[] args) {
  5.         Scanner console = new Scanner(System.in);
  6.  
  7.         int n = Integer.parseInt(console.nextLine());
  8.         int multiplier = Integer.parseInt(console.nextLine());
  9.  
  10.         if (multiplier <= 10) {
  11.             for (int i = multiplier; i <= 10; i++) {
  12.                 System.out.printf("%d X %d = %d%n", n, i, i * n);
  13.             }
  14.         } else {
  15.             System.out.printf("%d X %d = %d%n", n, multiplier, multiplier * n);
  16.         }
  17.  
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment