<?php
$sum = 0;
for ($i = 2; $i <= 10; $i += 2) {
$sum += $i;
}
echo "The sum of even numbers between 1 and 10 is: $sum";
?>
<?php
$sum = 0;
for ($i = 2; $i <= 10; $i += 2) {
$sum += $i;
}
echo "The sum of even numbers between 1 and 10 is: $sum";
?>
Related
How to get the largest element in an array of numbers |
how to get current latitude and longitude using google map api in php? |
Write a PHP script that generates a random password of a specified length. |
Write a PHP script that calculates the factorial of a given number using an iterative approach. |
Create a PHP function to count the number of vowels in a string. |
Write a PHP script that generates and displays a list of the first 10 Fibonacci numbers. |
Create a PHP script that calculates and displays the area of a rectangle given its length and width. |
Write a PHP script that calculates the factorial of a given number. |
