Please code the arrays. This is in PHP/HTML Perform some calculations: 1. $ages = [24, 12, 10,...

80.2K

Verified Solution

Question

Programming

Please code the arrays. This is in PHP/HTML

Perform some calculations:

1. $ages = [24, 12, 10, 17, 23, 29, 35, 32, 30, 22] Using a FORloop, calculate the sum and average of these numbers, then printthem. Please provide legible output.

2. If I change the array to $ages = [1 => 24, 12, 10, 17, 23,29, 35, 32, 30, 22] How will the program change? Re-run the programand provide output

3. Assume that the above array is an associative array asfollows:

$ages = ['Sam' => 24, 'Tina' => 12, 'Liz' => 10, 'Tom'=> 17, 'Dave' => 23, 'Sandra' => 29, 'Kris' => 35,'Mike' => 32, 'Daja' => 30, 'Rajan' => 22]

Write a program to print each name and its associated age on asingle line; i.e., Sam => 24 . . . and so on

Answer & Explanation Solved by verified expert
4.2 Ratings (812 Votes)
    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students