Advertisement
valitomi

Untitled

Feb 26th, 2021
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6. public static void main(String[] args) {
  7.  
  8.  
  9. Scanner sc = new Scanner(System.in);
  10. int[] a =new int[5];
  11. for(int i=0;i<a.length;i++){
  12. a[i]=sc.nextInt();
  13. }
  14. Arrays.sort(a);
  15. int result =a[2];
  16. int e = 0;
  17. while (e<3) {
  18. e=0;
  19. if (result % a[0] == 0) {
  20. e++;
  21. }
  22. if (result % a[1] == 0) {
  23. e++;
  24. }
  25. if (result % a[2] == 0) {
  26. e++;
  27. }
  28. if (result % a[3] == 0) {
  29. e++;
  30. }
  31. if (result % a[4] == 0) {
  32. e++;
  33. }
  34. if (e >= 3) {
  35. System.out.println(result);
  36. break;
  37. }
  38. result++;
  39.  
  40.  
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement