Advertisement
damesova

Multiply Teble - Java

Dec 16th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. package TrialExam16Dec18;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Task_6 {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int num = Integer.parseInt(scanner.nextLine());
  10.  
  11.  
  12. int a = num % 10;
  13. int temp = num - a;
  14. int b = (temp / 10) % 10;
  15. int c = num / 100;
  16.  
  17. for (int i = 1; i <= a; i++) {
  18. for (int j = 1; j <= b; j++) {
  19. for (int k = 1; k <= c; k++) {
  20.  
  21. int result = i * j * k;
  22. System.out.printf("%d * %d * %d = %d;%n", i, j, k, result);
  23.  
  24. }
  25. }
  26. }
  27.  
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement