answersLogoWhite

0

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

9y ago

What else can I help you with?

Related Questions

What is the time complexity of the Karatsuba algorithm for multiplying two numbers?

The time complexity of the Karatsuba algorithm for multiplying two numbers is O(nlog2(3)), which is approximately O(n1.585).


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


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

the two numbers can only be 24 and24


Why is booth algorithm fast for multiplication two binary numbers?

Shifting in easily accomplished in hardware.


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

using OR ().


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.


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.


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.