<?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
Write a PHP script that connects to a MySQL database and fetches data from a table. |
How to check if a given number is a perfect number. |
How to show location using google map in JavaScript? |
Write a PHP script that sets a cookie with user preferences and retrieves it on subsequent visits. |
Write a PHP script that parses JSON data and displays specific information. |
How to reverses a given string using PHP. |
how to get response status in api using curl php? |
Write a PHP script that calculates the sum of digits in a given number. |