Publicidad
Please help me with my PHP programming assignment- 1- Write a PHP prog.docx
Please help me with my PHP programming assignment- 1- Write a PHP prog.docx
Please help me with my PHP programming assignment- 1- Write a PHP prog.docx
Próximo SlideShare
php 1php 1
Cargando en ... 3
1 de 3
Publicidad

Más contenido relacionado

Más de rtodd19(20)

Publicidad

Please help me with my PHP programming assignment- 1- Write a PHP prog.docx

  1. Please help me with my PHP programming assignment. 1- Write a PHP program that goes through all integers between 1 and 100 (exclusive) and displays each even number on a separate line. 2- Re-write the program in question 1 but this time use a function to go through the numbers and display them. Note: Question one has been solved, please give me feedbacks regard of question two. Please copy and paste your code after you finish. Solution /* main.php */ /* PHP program that goes through all integers between 1 and 100 (exclusive) and displays each even number on a separate line. */ <html> <head> <title>PHP Program</title> </head> <body> <?php for ($i=1; $i<=100; $i++) { if($i%2==0) echo $i."<br/>"; } ?> </body> </html> /* main2.php */ /* function to go through the numbers and display them. */
  2. <html> <head> <title>PHP Function</title> </head> <body> <?php /* Defining a PHP Function */ function displayNumbers() { for ($i=1; $i<=100; $i++) { if($i%2==0) echo $i."<br/>"; } } /* Calling a PHP Function */ displayNumbers(); ?> </body> </html> /* output 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48
  3. 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 */
Publicidad