<?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 convert a temperature from Celsius to Fahrenheit using php. |
Create a PHP script that calculates the average of an array of numbers. |
Create a PHP script that checks whether a given number is a prime number or not. |
Create a PHP script that counts the number of occurrences of each word in a given sentence. |
Create a PHP script that uses sessions to store and display user information. |
How to check whether a given year is a leap year using php. |
Write a PHP script that sets a cookie with user preferences and retrieves it on subsequent visits. |
Write a PHP script that generates a random password of a specified length. |
