Computer Science, asked by biswasjayatu, 8 months ago

Find Key: You are provided with 3 numbers : input1, input2 and input 3. Each of these are four digit numbers within the range >=1000 and <=9999 j.e. 1000 <= input1 <= 9999 1000 <= input <= 9999 1000 <= input <= 9999 You are expected to find the Key using the below formula - Key = [largest digit in the thousands place of all three numbers] [largest digit in the hundreds place of all three numbers] [largest digit in the tens place of all three numbers] [largest digit in the units place of all three numbers] For e..g. if input1 = 3521. input 2=2452. input 3=1352, then Key = [1][3][2][1]= 1321 Assuming that the 3 numbers are passed to the given function, complete the function to find and return the key

Answers

Answered by aayushupadhyay46
36

Answer:

I will tell you answer but now Mark me as Brainlist

Answered by aburaihana123
0

Three numbers are passed and function to find and return the key is proved by below algorithm

Explanation:

public static void main(String[] args)

{

(all 3 inputs)

  int input1 = 3521;

  int input2 = 2452;

 int input3 = 1352;

(convert into array of input1)

  String str1 = "" ;

  str1 = String.valueOf(input1);

 char ch1[];

 ch1 = str1.toCharArray();

  (convert into array of input2)

 String str2 ="";

 str2 = String.valueOf(input2);

char ch2[];

ch2 = str2.toCharArray();

(convert into array of input3)

 String str3 ="";

 str3 = String.valueOf(input2);

 char ch3[];

ch3 = str3.toCharArray();

(for input1 to get max and min value)

 int max1 = MaxFind(ch1);

System.out.println(max1);

int min1 = Min Find(ch1);

(for input2 to get max and min value)

int max2 = MaxFind(ch2);

int min2 = MinFind(ch2);

(for input3 to get max and min value)

int max3 = MaxFind(ch3);

int min3 = MinFind(ch3);

int key = ((max1+ max2 + max3 ) + (min1 + min2 + min3));

System.out.println("our key is " + key);

char arr10[] = {2,5,7,6,3,1} ;

System.out.println(MaxFind(arr10));  

System.out.println(" max " + max);

System.out.println("min " + min );

  }

}

#SPJ3

Similar questions