128. PHP Program to Compute the Given Series 1/2 + 3/4 + 5/6 +……+ 99/100
How does this program work?
- This program is used to find the Sum of the given series 1/2 + 3/4 + 5/6 +……+ 99/100 using PHP.
- The integer entered by the user is stored in variable x and n .
- By using the for loop condition we can easily calculate the sum of given series.
Here is the code
<html>
<head>
<title>Find the Sum of given Series</title>
</head>
<body>
<?php
$sum = 0.0;
$precision= 4;
for($i=1; $i<=99; $i++) {
$sum = $sum + ($i/($i+1));
$i++;
}
echo "Sum of series 1/2 + 3/4 + 5/6 + ....+99/100 is = ".number_format($sum, $precision); ?>
</body>
</html>

