<?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 script that processes a form submission and displays the submitted data. |
Write a PHP function that throws a custom exception if a condition is not met. |
Write a PHP script that checks if a given string is a valid email address. |
How to get the largest element in an array of numbers |
how to get current latitude and longitude using google map api in php? |
how to get country, state and city select option using google map api in php |
Write a PHP script that generates and displays a simple multiplication table for the numbers 1 to 5. |
Write a PHP script that generates and displays a list of the first 10 Fibonacci numbers. |