CSC220 Lab 3 2010

From dftwiki3
Revision as of 19:42, 19 September 2010 by Thiebaut (talk | contribs) (Created page with '--~~~~ ---- =First Problem= * Write a php page that declares 2 variables $a, and $b, set both of them to some values of your choice, and displays their contents, sum, and diffe…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut 23:42, 19 September 2010 (UTC)


First Problem

  • Write a php page that declares 2 variables $a, and $b, set both of them to some values of your choice, and displays their contents, sum, and difference.
  • Your page should display something like this:
$a = 5
$b = 10
$a + $b = 5 + 10 =  15
$a - $b = 5 - 10 =  -5
  • Make sure you create your page in your ~220a-xx/public_html directory, and remember to chmod a+r your Php files!

Second Problem

  • Write a Php page that uses a for loop and that displays all the numbers from 1 to 10, as follows:
1
2
3
4
5
6
7
8
9
10

Third Problem

  • Same as Problem 2, but add a test in your loop so that the output becomes as shown below:
1 odd
2 even
3 odd
4 even
5 odd
6 even
7 odd
8 even
9 odd
10 even


Fourth Problem

  • Same as Problem 3, but this time the 10 lines are output in an html table.
  • The code for the table should look something like this:


1 odd
2 odd
3 odd
4 odd
5 odd
6 odd
7 odd
8 odd
9 odd
10 odd











[[Category:CSC220]