how to find greatest number code example
Example: find the greatest of numbers
# maiorAB = ((a+b)+abs(a-b))/2 Formula for find the greatest of number.
# This formula work like if we have 3 value like a, b, c then,
# 1st step d1 = ((a+b)+abs(a-b))/2 where abs() means absolute value or positive value of a number like |-4| = 4
# 2nd step d2 = ((d1+c)+abs(d1-c))/2 where d1 come from the 1st step
# Now illustration of the formula if a = 5, b = 10 & c = 15 then,
# d1 = ((5+10)+abs(5-10))/2 where, (5+10) = 15, abs(5-10) = 5 or |5-10| = 5, So, (15+5)/2 = 10
# d2 = ((10+15)+abs(10-15))/2 where, (10+15) = 25, abs(10-15) = 5 or |10-15| = 5, So, (25+5)/2 = 15
# d2 = 15 is the gretest of 3 numbers.
# So, we can find the greatest of 3 number in 2 step.
# Number_of_step = Number_of_values - 1
==> Author: Sourove Roy.