<?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
what is PhpUnit? |
Write a PHP script that generates and displays a list of the first 10 Fibonacci numbers. |
how to get current latitude and longitude using google map api in php? |
How to convert a temperature from Celsius to Fahrenheit using php. |
Write a PHP script that connects to a MySQL database and fetches data from a table. |
Write a PHP function that throws a custom exception if a condition is not met. |
Write a PHP script that parses JSON data and displays specific information. |
Create a PHP script that calculates the average of an array of numbers. |
