How To Find Max Of 3 Numbers Without Using Comparison Operators?
rasheed1982 0 Newbie Poster
Recommended Answers
Jump to Post>Then why don't you suggest another way.
How about you figure it out instead of encouraging people to do the OP's homework.
Jump to Postsimple arithmetic is all you need...
max(a,b) = ( a + b + abs ( a - b ) ) / 2
min(a,b) = ( a + b - abs ( a - b ) ) / 2
Jump to PostIts no coding secret or something but a simple formula kind of thing here it is :
For two numbers:
max( a , b ) = ( a + b + abs( a - b ) ) / 2
For three numbers it is:
max( a …
All 12 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
rasheed1982 0 Newbie Poster
SpS 34 Posting Pro
Rashakil Fol 978 Super Senior Demiposter Team Colleague
SpS 34 Posting Pro
Narue 5,707 Bad Cop Team Colleague
Bench 212 Posting Pro
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Narue 5,707 Bad Cop Team Colleague
SpS 34 Posting Pro
6finger 1 Newbie Poster
dkalita commented: great :) +1
csurfer 422 Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.