Write a program to find the odd man out in same difference series.
Input (int[]) | Output (int) |
---|---|
{8, 14, 21, 28, 35, 42} | 8 |
{5, 10, 15, 23, 25, 30} | 23 |
{143, 120, 97, 74, 51, 28, 5, -17} | -17 |
{59, 118, 177, 236, 295, 354, 413, 472, 530} | 530 |
{1000, 1198, 1396, 1596, 1792, 1990, 2188, 2386, 2584} | 1596 |
{40960, 40000, 39040, 38080, 37120, 36160, 35220, 34240, 33280} | 35220 |
class OddManOutInSameDifferenceSeries
{ public static void main(String s[])
{
int input[] = {8, 14, 21, 28, 35, 42};
System.out.println("The odd man is : " + findOddManOut(input));
}
public static int findOddManOut(int[] input) {
//Write code here to find the odd man in the same difference series
}
}
Topic: Learn Arrays And Loops