Write a program to find the odd man out in multiply and add series. Assume that the multipliers and addends are between -10 and 10.
Input (int[]) | Output (int) |
---|---|
{5, 9, 17, 33, 65, 128} | 128 |
{12, 25, 49, 97, 193, 385, 769, 1537} | 12 |
{17, 33, 66, 129, 257, 513, 1025} | 66 |
{15, 29, 57, 113, 225, 494, 897} | 494 |
{23, 46, 89, 177, 353, 705} | 46 |
class OddManOutInMultiplyAndAddSeries
{ public static void main(String s[])
{
int input[] = {5, 9, 17, 33, 65, 128};
System.out.println("The odd man is : " + findOddManOut(input));
}
public static int findOddManOut(int[] input) {
//Write code here to find the odd man out number from the given input and return it
}
//If required, write any additional methods here
}
Topic: Learn Arrays And Loops