code:-
 
<?php
$sum = 0;
for($x=1; $x<=20; $x++)
{
$sum +=$x;
}
echo "The sum of the numbers 0 to 20 => $sum";
?>

output:-

The sum of the numbers 0 to 20 => 210

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post