Write a python program using bitwise operators to find maximum between four numbers.
Answers
Answered by
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
Math,
4 months ago
Math,
4 months ago
Social Sciences,
9 months ago
English,
1 year ago
Math,
1 year ago