Write a program to get the common minimum number between two arrays
It returns -999, when there is no common number
Input(First Array, Second Array) | Output |
---|---|
{-3, 14, -16, 82, 22}, {-3, -16, 12, 14, 48, 96} | -16 |
{-45, -35, 67, 12, 2}, {100, 76, 23, 67} | 67 |
{183, 164, 105, 125}, {185, 4, 125} | 125 |
{5, 10, 25, 50, 100}, {20, 30, 40, 60, 70, 90} | -999 |
class CommonMinimumNumber
{ public static void main(String s[])
{
int firstArray[] = {2, 14, 6, 82, 22};
int secondArray[] = {3, 16, 12, 14, 48, 96};
int number = getCommonMinimumNumber(firstArray, secondArray);
System.out.println("The number is " + number);
}
public static int getCommonMinimumNumber(int firstSeries[], int secondSeries[])
{
//Write a code here to get the common minimum number and return it.
}
}
Topic: Learn Arrays And Loops