Computer Science, asked by sabarishnaramsp2fog9, 1 month ago

John was given three numbers and was asked to find the biggest number among them. He has written a logic to find biggest number but he could get only second biggest all the time. Please help John in finding the right logic.​

Answers

Answered by varunsharma86749
6

John was given three numbers and was asked to find the biggest number among them. He has written a logic to find biggest number but he could get only second biggest all the time. Please help John in finding the right logic.

Answered by Jasleen0599
0

# Python3 program

n1 = 5

n2 = 10

n3 = 15

mx = (n1 if (n1 > n2 and n1 > n3) else

(n2 if (n2 > n1 and n2 > n3) else n3))

print("Largest number among " + str(n1) +

     " , " + str(n2) +

    " and " + str(n3) +

    " is " + str(mx))

  • The first step in the algorithm is to input the three numbers and store them in variables.
  • Verify that the first number is greater than the other two to see.
  • For the other two numbers, repeat step 2 above.
  • Print the highest number among them all and then leave.
  • The largest number among three numbers can be found in C in a variety of methods. Let's examine each method for determining the largest/biggest of three values in depth.

#SPJ2

Similar questions