Advertisement
veronikaaa86

11. Multiplication Table 2.0

May 18th, 2022
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 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. if (times > 10) {
  13. int product = num * times;
  14. System.out.printf("%d X %d = %d%n", num, times, product);
  15. } else {
  16. for (int i = times; i <= 10; i++) {
  17. int product = i * num;
  18. System.out.printf("%d X %d = %d%n", num, i, product);
  19. }
  20. }
  21. }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement