Find greatest among 3 numbers

In this exercise you have to find greatest among 3 numbers. Solve the exercise using any of your favorite programming language using javascript or PHP

Find greatest among 3 numbers – requirements

The requirement is to find greatest among 3 numbers. You can either let the users enter 3 numbers using a prompt box and store it in a variable or use 3 inputs text field to accept number or define 3 variables and store values in it. If you are comfortable working with arrays, you can use an array of 3 numbers for comparision.

Find greatest among 3 numbers – hints

  • Compare the first two numbers using a if/else statement and save value of the greater number in a temporary variable named “larger’.
  • Now compare the value of third number with the value stored in  the ‘larger’ variable using the if/else statement.
  • Display the greatest number using an alert box or show it in the body of the page using document.write

Make use of any online editors such as www.jsfiddle.com or https://glitch.com/ and mail me your assignment at ansariparvez@gmail.com for any help or feedback.

Need help? here is the the tutorial

One thought on “Find greatest among 3 numbers”

Comments are closed.