Problem Statement
Given five positive integers, their least majority multiple is the smallest positive integer that is divisible by at least three of them.
Given distinct ints a, b, c, d and e, return their least majority multiple.
Definition
- Class:
- LeastMajorityMultiple
- Method:
- leastMajorityMultiple
- Parameters:
- int, int, int, int, int
- Returns:
- int
- Method signature:
- int leastMajorityMultiple(int a, int b, int c, int d, int e)
- (be sure your method is public)
Constraints
- a, b, c, d and e will each be between 1 and 100, inclusive.
- a, b, c, d and e will be distinct.
Examples
1
2
3
4
5
Returns: 4
4 is divisible by 1, 2, and 4 - the majority of the given five numbers.30
42
70
35
90
Returns: 210
210 is divisible by 30, 42, 70, and 35 - four out of five numbers, which is a majority.30
45
23
26
56
Returns: 1170
3
14
15
92
65
Returns: 195