Computer Science, asked by Anonymous, 9 months ago

Write a python program using bitwise operators to find maximum between four numbers.​

Answers

Answered by rishavsharma21pd1prg
0

Answer:

Mark me as brainliest

Check for indent because this brainly editor has removed or added some indent

def maxOfFour(w, x, y, z):  

   a = [0] * 2

   a[0] = w  

   a[1] = x    

   b = bool(a[0] - a[1] + abs(a[0] - a[1]))  

   if b:  

       b = 1

   else:  

       b = 0

   a[0], a[1 - b] = a[1 - b], a[0] 1

   a[1] = y  

   b = bool(a[0] - a[1] + abs(a[0] - a[1]))  

   if b:  

       b = 1

   else:  

       b = 0

   a[0], a[1 - b] = a[1 - b], a[0]  

   a[1] = z  

   b = bool(a[0] - a[1] + abs(a[0] - a[1]))  

   if b:  

       b = 1

   else:  

       b = 0

   a[0], a[1 - b] = a[1 - b], a[0]  

     

   return a[0]  

w = 12

x = 15

y = 18

z = 17

print("Maximum of four : ", maxOfFour(w, x, y, z))

Similar questions