<?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
Create a PHP function to count the number of vowels in a string. |
Write a PHP script that checks if a given string is a valid email address. |
how to get current latitude and longitude using google map api in php? |
Create a PHP script that calculates the average of an array of numbers. |
Create a PHP script that processes a form submission and displays the submitted data. |
How to check if a given number is a perfect number. |
Write a PHP script that calculates the factorial of a given number. |
Write a PHP function to check if a given string is a palindrome |