Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.util.ArrayList;
- public class main {
- public static void main(String[] args) {
- int c = 1;
- int[] num = new int[]{1, 2, 3, 4, 5};
- int numberCounter = 0;
- while (numberCounter < 3) {
- for (int i = 0; i < num.length; i++) {
- if (mod(num[i], c)) {
- numberCounter++;
- }
- }
- if (numberCounter < 3) {
- numberCounter = 0;
- c++;
- }
- }
- System.out.print(c);
- }
- public static boolean mod(int a, int b) {
- return b % a == 0;
- }
- }
Add Comment
Please, Sign In to add comment