answersLogoWhite

0


Best Answer

The function already exists in PHP and is even called max(); Otherwise use:

function max ($one, $two)

{

return $one > $two ? $one : $two;

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Design a function named max that accepts two integer values as arguments and returns the value that is greater of the two For example if 7 and 12 are passed as arguments to the function the function?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is recursive call in terms of algorithm?

A recursive call in an algorithm is when a function (that implements this algorithm) calls itself. For example, Quicksort is a popular algorithm that is recursive. The recursive call is seen in the last line of the pseudocode, where the quicksort function calls itself. function quicksort('array') create empty lists 'less' and 'greater' if length('array') ≤ 1 return 'array' // an array of zero or one elements is already sorted select and remove a pivot value 'pivot' from 'array' for each 'x' in 'array' if 'x' ≤ 'pivot' then append 'x' to 'less' else append 'x' to 'greater' return concatenate(quicksort('less'), 'pivot', quicksort('greater'))


Program to fnd the numbers are equal in Java script?

To test if two number are equal in JavaScript, we use the == operator and compare them. The below function test if two number (a and b) are equal. The function returns 1 if a is greater, -1 if b is greater, and 0 if the numbers are of equal value. function isEqualTo( a, b ){ if ( a > b ){ return 1; } if (b > a ){ return -1; } return 0; }


What is the function of transition piece in pipe fittings?

Transition piece is mostly used where there is variation of Wall thickness greater tha 3/16" or the yield strength difference is greater than 20 ksi.


Is there an algorithm which accepts two numbers from the user and displays which of the two numbers are relatively greater?

Algorithm:Given x and y are both numbers, if x is greater than y then return x, otherwise return y.C++ implementation of the algorithm:template T GetMax(T x, T y) { return(x>y?x:y); }


Can gravitational acceleration of a body be greater then 10?

Yes if the body is for example near Jupiter

Related questions

What could be an example of a function with a domain and a range where a is greater than 0 and b is greater than 0?

f(x) = (x)^ (1/2) (i.e. the square root of x)


How does an exponential function differ from a power function graphically?

An exponential function of the form a^x eventually becomes greater than the similar power function x^a where a is some constant greater than 1.


What are the standard operators in Excel?

The logical operators in Excel are as follows. < is less than, > is greater than, = is equals. <= is less than or equals and >= is greater than or equals. Not equal to is written as <>.


Is y greater than x 2 a function?

no, but y = x2 is a function


Is sine greater than one?

No angle has a sine function greater than 1.


How do you find the range from the set of domains?

You need to have some idea about the behavior of whatever function you are using. As an example, if your function is f(x) = x2, you probably know that the lowest value this can have is 0 (for x = 0), and that for other values of x, the function will be positive. Also, that the function can achieve any positive value. So, in summary, for the set of real numbers, the function can take on any value greater or equal to zero. As another example, the sine function can only produce values between -1 and 1 (inclusive).


What is the sine for greater than?

The sign is >. Sine is a trigonometric function.


What does the inc function do in clojure?

Returns a number one greater.


Which numbers are greater than 5.22?

There are infinitely many numbers: for example any number greater than 6, for example.


How do you write greater than?

The symbol for greater than is > as for example 8 > 6


What is greater than 1 12?

627 3/4 is greater, for example.


Why do certain cells have a greater preponderance of certain organelles?

It depends on the function of the cell. For example: the muscle cells require a great deal of energy and so require many mitochondria per cell.