Find Key:
You are provided with 3 numbers : input1, input2 and input3.
Each of these are four digit numbers within the range >=1000 and <=9999.
i.e.
1000 <= input1 <= 9999
1000 <= input2 <= 9999
1000 <= input3 <= 9999
You are expected to find the Key using the below formula -
Key = (Thousands digit of input1 x Hundreds digit of input2) - (Largest digit of input3)
For e..g. if input1 = 3521, input2=2452, input3=1352, then Key = (3 x 4) - 5 = 7
ng
Assuming that the 3 numbers are passed to the given function, Complete the function to find
and return the Key.
Answers
this is your answer
#HOPE THIS IS HELPFUL TO YOU
Answer:
Explanation:
import java.io.*;
import java.util.;
// Read only region start class
UserMainCode
public int findKey(int inputi, int input2, int input3){
// Read only region end
int largest = 0;
int smallest = 10;
int thousand = 0;
int hundred = 0;
int digit = 0;
thousand - input 1/1000;
hundread - (input2/100) % 10;
while(input3 > 0) {
digit = input 3%10;
if(digit > largest)
largest = digit;
if(digit<< smallest)
smallest digit;
else if(digit == 0)
smallest =0;
input3 /= 10;
public int findKey(int inputi, int input2, int i
// Read only region end
int largest = 0;
int smallest = 10;
int thousand = 0;
int hundred = 0;
int digit = 0;
thousand = input 1/1000;
hundred = (input2/100) % 10;
while(input3 > 0){
digit = input3%10;
if(digit > largest)
largest = digit;
if(digit<smallest)
smallest = digit;
else if(digit == 0)
smallest = 0;
input3 /= 10;
int key (thousand * hundread) + smallest;
return key;
THis will find the key
#SPJ2