<?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 show location using google map in JavaScript? |
Write a PHP script that calculates the sum of digits in a given number. |
Write a PHP script that generates and displays a list of the first 10 Fibonacci numbers. |
Write a PHP script that generates and displays a simple multiplication table for the numbers 1 to 5. |
Create a PHP script that calculates the average of an array of numbers. |
Create a PHP script that uses sessions to store and display user information. |
how can i solve php header errors? |
Write a PHP script that calculates the factorial of a given number. |