Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int[] a =new int[5];
- for(int i=0;i<a.length;i++){
- a[i]=sc.nextInt();
- }
- Arrays.sort(a);
- int result =a[2];
- int e = 0;
- while (e<3) {
- e=0;
- if (result % a[0] == 0) {
- e++;
- }
- if (result % a[1] == 0) {
- e++;
- }
- if (result % a[2] == 0) {
- e++;
- }
- if (result % a[3] == 0) {
- e++;
- }
- if (result % a[4] == 0) {
- e++;
- }
- if (e >= 3) {
- System.out.println(result);
- break;
- }
- result++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement