PHP Programs

Please click on 1-2 Ads to keep this website's Study Material FREE and regularly Updated.

Program 14: Write a PHP program using a loop to add all the integers 0 and 35 and display the sum.

sum.php

<!DOCTYPE html>
<html>
<head>
	<title>PHP Programs TutorialDuniya.com</title>
</head>
<body>
	<?php
	$sum = 0;

	for($num =1; $num<=35; $num++)
	{
		$sum +=$num;
	} 

	echo "The sum of the numbers 0 to 35 is $sum"."\n";
	?>
</body>
</html>



If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.