Question 4

(b) Write a PHP program to make the sum of first 100 odd numbers.
			
			
          

<html>
<body>
<?php
$sum = 0;
$counter = 0;
for($i = 0;$counter < 100;$i++)
{
if($i%2 != 0)
{

$sum += $i;
$counter++;

}
}
echo $sum;
?>
</body>
</html>

			
			
        

Make Comments..!!


Oops!! No posts from user.

Download Android App