125. PHP Program to Compute the 1.0+1.1+1.2+1.3 + …… + 2.5 Series.
How does this program work?
- This program is used to find the Sum of the given series 1.0+1.1+1.2+1.3 + …… + 2.5 using PHP.
- Declare variables sum and n and Initially initialize with 1.
- By using for loop we can find the sum of given series upto nth term.
Here is the code
<html>
<head>
<title>Find the Sum of given Series</title>
</head>
<body>
<?php
$n = 1;
$sum = 1;
for ($i=0.0; $i<= 1.6; $i+=0.1)
{
$n = 1+$i;
$sum = $sum + $n;
}
echo "Sum of given series is : " .$sum;
return 0;
?>
</body>
</html>