0% found this document useful (0 votes)
102 views3 pages

Find Key

Uploaded by

arun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
102 views3 pages

Find Key

Uploaded by

arun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 3
Gow tc UN Sey PAT Titel Mt a a A ea eae at ee @Mercer | meittl 1. Section 1 ~ oO 1 Question 1 D1 Revisit Later JAVA 6 How to Attempt? ? 8 Find Key: 9 You are provided with 3 numbers: inputt, input2 and input3. 10 Each of these are four digit numbers within the range >=1000 and <=9999. 1 ie. 32 1000 <= input1 <= 9999 a 1000 <= input2 <= 9999 AS 1000 <= input3 <= 9999 aa 7 You are expected to find the Key using the below formula - 1s a9 Key = (Sum of Largest digits of all the 3 numbers) + (Sum of Smallest digits of all the 3 20 numbers) For e.g. if inputt = 3521, input2=2452, input3=1352, then Key = (5+5+5) + 2 (14241) = 19 22 23 24 Assuming that the 3 numbers are passed to the given function, Complete the function to Ee find and return the Key. 26 27 28 29 30 31 D Use = © Need Help? Cont © Test Time: 01:13:04 tempted: 2/2 Compiler: Java - 1.7 9D // Read only region start class UserMainCode { public int findkey(int inputt, int input2,int input3){ // Read only region end // write code here int n1=9,n2=9,n3=9,) },M2=0,m3=0;, nput2+"" ,dn3=input3+""; ' int sum=n14n2+n3+m1+m24m3; ’ return sum; L 2 7 aie oa 3 static int min(String s){ 4 int c=95 5 for(int ics. length() ;i++){ 6 if (coInteger .parseInt(s.charat(i)+"")){ 7 | ceInteger.parsernt(s.charat(i)+""); 8 | 3 9 } rr return ct Use Custom Input ® {33 +1 (800) 265-6038 cz +91 60471-90902 Powere 1 2 > ic ~ Attempted: 2/2 yorens 16 mi=max(dn1) ; W m2=max(dn2) 5 18 m3=max(dn3) 5 19 int sum=n1+n2+n3+m1+m2+4m3 ; 20 return sum; 2 22 } 23 static int min(String s){ 2a | int c=95 25 for(int i=0;iInteger.parseInt(s.charat(i)+"")){ 27 | | c=Integer.parseInt(s.charAt(i)+""); 28 | y 29 ir 30 | return Cc; 31 32 static int max(String s){ 33 | int c=0; 3a for(int i-0;i

You might also like