answersLogoWhite

0


Best Answer

Compare two numbers, a and b. If a is greater than b then return a, otherwise return b.

In C, we can implement this algorithm using the ternary operator (?:), as follows:

return a>b?a:b;

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the algorithm for determining the maximum of two numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

The result obtained when two or more numbers are mutiplied is called a what?

multiplication algorithm What?? The answer is: their product.


What are the maximum numbers of diagonal a quadrilateral can have?

Two of them


How do you draw a flow chart for determining if the two numbers are equal or not?

using OR ().


Why is booth algorithm fast for multiplication two binary numbers?

Shifting in easily accomplished in hardware.


What is the maximum product of two numbers if their sum is 48?

the two numbers can only be 24 and24


If the square of two numbers is one and the product is maximum?

If the two numbers are x and y, thenthe square of the two numbers is one => (xy)^2 = 1 which implies that xy = +/-1.Then xy is a maximum => xy = 1.


The sum of two whole numbers is 33 what is their maximum product?

272 is the maximum possible.


Two real numbers whose sum is S and whose product is a maximum?

find two positive numbers whose product is a maximum. 1.) the sum is s.


How do you sort an array of numbers?

Use a sorting algorithm. There are a bewildering number of sorting algorithms, both stable and unstable. To sort numbers, an unstable sort suffices. The algorithm you use will depend on how many numbers need to be sorted (a small or a large set), however a hybrid algorithm (a combination of two or more algorithms) can cater for both. Introsort (unstable) and timsort (stable) are the two most common hybrid sorting algorithms.


Do you prefer to calculate the gcf of two numbers by listing factors or by determining the prime factorzation explain your awnser?

Determining the prime factorization. It's faster and more efficient with larger numbers.


Is the sum of two natural numbers always a natural number?

Yes. You know this is true because you learned a process-- an "algorithm"--for adding two numbers together, and if you start with two whole numbers, the result is also a whole number.


What is the maximum number of rational number between any two rational numbers?

There are [countably] infinite rational number between any two rational numbers. There is, therefore, no maximum.