Skip to content

JulianaMancera/AppDev_Lab-3_PHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AppDev_Lab-3_PHP

Challenge 1

Create a multiplication table using a nested for loop. The table output should look like this:

Multiplication Table

1 x 1 = 1 
1 x 2 = 2
1 x 3 = 3
1 x 4 = 4
1 x 5 = 5
1 x 6 = 6
1 x 7 = 7
1 x 8 = 8
1 x 9 = 9
1 x 10 = 10
and so on...

Challenge 2

Get the sum of the numbers in an array by using a foreach loop and for loop.

$numbers = [1, 2, 3, 4, 5]; //sum using foreach loop
$numbers2 = [1, 2, 3, 4, 5,6,7,8,9,19]; //sum using for loop

Sample Output

Sum array using foreach loop
15
Sum array using for loop
64

Challenge 3

Calculate the average students grade from an array of students. Each student has their own array with the key grades.

  1. Create an array of students with their names and grades (0 - 100)
    john 85, 90, 92, 88
    jane 95, 88, 91, 87
    joe 75, 82, 79, 88

  2. Iterate over the students array with a foreach loop

  3. Calculate the average grade for each student.

Sample Output

Average Grade 
John: Average Grade = 88.75 
Jane: Average Grade = 90.25 
Joe: Average Grade = 81 

About

Applications Development & Emerging Technologies - PHP Lab Activity #3

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages