0% found this document useful (0 votes)
2 views2 pages

PHP Task

The document outlines a series of programming tasks involving variables, conditional statements, arrays, loops, and functions. It includes specific instructions for declaring variables, displaying information in HTML, calculating grades based on percentage marks, creating and displaying arrays, and defining a function to calculate the average of three numbers. Each task is designed to reinforce fundamental programming concepts and practices.

Uploaded by

aliarshad078609
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

PHP Task

The document outlines a series of programming tasks involving variables, conditional statements, arrays, loops, and functions. It includes specific instructions for declaring variables, displaying information in HTML, calculating grades based on percentage marks, creating and displaying arrays, and defining a function to calculate the average of three numbers. Each task is designed to reinforce fundamental programming concepts and practices.

Uploaded by

aliarshad078609
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Task 1: Variables and Output

1. Declare the following variables:


o Student name (string)
o Age (integer)
o Is enrolled (boolean)
o Percentage marks (float)
2. Display a short introduction sentence using these variables inside HTML.

Expected Output Example:

Hello, my name is Sara. I am 22 years old and currently enrolled.

Task 2: Conditional Statements

1. Based on the percentage marks:


o 85 and above → Grade A
o 70 to 84 → Grade B
o Below 70 → Grade C
2. Display the percentage and the calculated grade.

Task 3: Arrays

1. Create:
o An indexed array of at least 5 programming languages.
o An associative array containing student details (name, email, city).
2. Display:
o All programming languages using a loop.
o Student details using array keys.

Task 4: Loops

1. Use a for loop to display numbers from 1 to 10.


2. Use a foreach loop to display all values of the programming languages array.

Task 5: Functions

1. Create a function named calculateAverage() that:


o Accepts three numbers as parameters.
o Returns their average.
2. Call the function and display the result in HTML.

You might also like