Advertisement
veronikaaa86

11. Multiplication Table 2.0

May 11th, 2023
1,034
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. package basicSyntax;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P11MultiplicationTable2 {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int num = Integer.parseInt(scanner.nextLine());
  10.         int times = Integer.parseInt(scanner.nextLine());
  11.  
  12.         do {
  13.             System.out.printf("%d X %d = %d%n", num, times, num * times);
  14.             times++;
  15.         } while (times <= 10);
  16.  
  17.  
  18. //        if (times > 10) {
  19. //            int product = num * times;
  20. //            System.out.printf("%d X %d = %d%n", num, times, product);
  21. //        } else {
  22. //            for (int i = times; i <= 10; i++) {
  23. //                int product = num * i;
  24. //                System.out.printf("%d X %d = %d%n", num, i, product);
  25. //            }
  26. //        }
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement