Write a program that reads 10 element and print all even values form them Using PHP
Example:
<title>PHP: Write a program that reads 10 element and print all even values form them Using PHP</title>
<?php
/* Write a program that reads 10 element and print all even values form them.*/
$n=array(1,2,3,4,5,6,7,8,9,10);
for($a=1;$a<=10;$a++)
{
if($n[$a]%2==0)
{
print"<br>"."Odd Number = ".$n[$a];
}
}
?>
OUTPUT:
Even Number = 2
Even Number = 4
Even Number = 6
Even Number = 8
Even Number = 10
No comments:
Post a Comment