a function that takes an integer array as an argument and
returns the largest value in the array. Use the function in
a program
Answer Posted / abd al-ala camara
<?php
// define function largest()
function largest($numbers) {
foreach ($numbers as $temp) {
$largestNumber = max($numbers);
}
return $largestNumber;
} // end function
$numbers = array(3, 45, 2, 56, 7, 9, 78, 23, 63);
echo largest($numbers); // if you want you can echo or just
use it another function or programe
?>
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Which operator is used to perform the comparison among 2 operands in the vbscript language?
Develop a parameterized action that accomplishes the following a. Launch a browser of users choice ( example : IE, chrome etc) b. Open up a search engine (Google, Bing etc) c. Perform a search d. Click a particular link depending on the user’s choice ( 1st , 2nd or third link)
Mention characteristics of sub procedures?
When to use function procedures and what are its characteristics?
Program to use input box and send even numbers into sheet1 and odd numbers into sheet2 and prime numbers into sheet3 using vbscript(QTP)?
Which operator is used to concatenate the 2 values in the vbscript language?
What is loose binding? Why is it not a good practice to use it?
Could Anybody Please tell me What is the script for Find 3rd Largest element in the Array without using a SORT function int Find(int arr[], int size); Thanks in Advance..
How will you get a string with the specified character the specified number of times in vbscript?
write a function to read the items from combobox of Flight reservation & save in excel (QTP)??
What are class events?
What are events in the vbscript language?
How you can call vbscript functions?
In html file what is an ideal position to include vbscript?
Write a Script for ATM in QTP