You are on page 1of 3

COURSE: INTRODUCTION TO PROGRAMMING (BIS227E)

LECTURERS: DR. ALI ALLAM / DR. MOHAMED SOBHY

ASSIGNMENT (8)

(1) Design a form that asks the user to input two even numbers. Then, write a
PHP webpage that prints all the even numbers in between.
(2) Write a program that prints numbers from (m) till (1) in a colored table (row-
by-row), where (m) is an input entered by the user.

(3) Write a program that prints numbers from (1) till (m) in a colored table
(column-by-column), where (m) is an input entered by the user.

Page 1 of 3
COURSE: INTRODUCTION TO PROGRAMMING (BIS227E)
LECTURERS: DR. ALI ALLAM / DR. MOHAMED SOBHY

(4) Design a PHP form that enables the user to enter the first names and last
names of a number of employees, where the user is first asked to enter the
number of employees:

Page 2 of 3
COURSE: INTRODUCTION TO PROGRAMMING (BIS227E)
LECTURERS: DR. ALI ALLAM / DR. MOHAMED SOBHY

(5) Design a form that contains three drop-down lists for each of the days (from
1 to 31), the months (from 1 to 12), and the years (from 1900 to 2100).

(6) Write a program that calculates and prints the sum of all the numbers between
1 and 10 (i.e. The sum is 55).
(7) Trace each of the following programs and figure out the output:
<?php
<table border=1>
$i=1;
<?php
do
$i=0;
{
$j=7;
if ($i%5==0)
while ($i<18)
echo "X ";
{
else
$i += $j - 1;
echo "$i ";
echo "<tr> <td>$i</td><td> $j</td></tr>";
$i++;
}
}
?>
while ($i<=20);
</table>
?>
<?php
$sum=0; <table border=1>
$x=1; <?php
$sign=1; $x=2;
while ($x<=9) $y=11;
{ for ($j=$x; $j<=2*$x*$y; $j += $y - $x)
$sum += $sign * $x; {
$sign = -1 * $sign; echo "<tr><td>$j</td><td>$x</td><td> $y</td></tr>";
$x += 2; }
} ?>
echo "Sum is $sum"; </table>
?>

Page 3 of 3

You might also like