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
who will create the object?
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 can you create an object in vbscript?
Which operator is used to concatenate the 2 values in the vbscript language?
What are the differences between sub procedures and function procedures?
how to write a vb script in QTP for yahoo registration form, i want to check the performance also like performance test, stress, load test like that.
Mention the environments where vbscript could be run?
How to throw an error in vbscript?
Which object is used to work with the database in the vbscript language and what statement is used to create this object?
Mention what if you do not specify anything when you call a procedure?
What is the use of option explicit in vbscript?
Explain about scrrun.dll?
hi i am trying for testing job for 3+ experience(fake) can u suggest me what type of projects i can keep in my resume and how much of knoeledge i should have abt that project.thnks in advance.urgt plz
What are the 2 ways in which a variable can be declared in the vbscript language?
1. How to handle object implementation change in DP for Ex: i have login page with username,pasword (editboxes),login,cancel(buttons). Here i written DP code for login page with the help properties. My questions: 1.If properites are changing dynamically i will do (i want code for that) 2.if objects are changed dynamcally i will do (i wnat code for that)