## Adobe Interview Question Development Support Engineers

• 0

find the maximum of three integers using conditional operator ?

Comment hidden because of low score. Click to expand.
0
of 0 vote

(x>y?x:y)>z?(x>y?x:y):z

Comment hidden because of low score. Click to expand.
0
of 0 vote

(((x>y)?x:y)>z)?((x>y)?x:y):z

Comment hidden because of low score. Click to expand.
0
of 0 vote

(x>y)? ( (x > z) ? x : z ) : ( (y > z) ? y : z )

Comment hidden because of low score. Click to expand.
0
of 0 vote

max = num1 > num2 ? num1 > num3? num1 : num3: num2 > num3 ? num2:num3;

Comment hidden because of low score. Click to expand.
0
of 0 vote

x>y ? x>z ? x : z : y > z ? y : z

Comment hidden because of low score. Click to expand.
0
of 0 vote

we can use concept
suppose if b>a then below concept can give b as output
c is average of a and b(in between) ;
d---> distance between avg and number(a or b);
c=(a+b)/2;
d=abs(a-b)/2;
so max number will be (c+d)..

a--------c--------b
<---d--->|<--d---->
so max that is b is (c+d);
for three number now get between b and another number using same concept.

Comment hidden because of low score. Click to expand.
0

chutiye !

Comment hidden because of low score. Click to expand.
0

@heehehhh
tu b chityaa

Comment hidden because of low score. Click to expand.
0
of 0 vote

I think the point of the question is to use conditional operator only ONCE.
I can do it using it twice:
( x > y && y > z ) ? x : ( y > z ? y : z );

Comment hidden because of low score. Click to expand.
0
of 0 vote

``````int a,b,c,d;
cin>>a>>b>>c;
d = (a>b)?(a>c?a:c):(b>c?b:c);
cout<<d<<endl;``````

Comment hidden because of low score. Click to expand.
0
of 0 vote

all the above fail for cases where all numbers are equal. It would only output the one that was compared last in the conditional.

Comment hidden because of low score. Click to expand.
0
of 0 vote

max=a>b?(c>a?c:a):(c>b?c:b);

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book walking you through every aspect of getting a job at a top tech company, while focuses on software engineering interviews.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.