<?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 check if a given number is a perfect number. |
Create a PHP function to count the number of vowels in a string. |
Write a PHP script that generates and displays a simple multiplication table for the numbers 1 to 5. |
what is PhpUnit? |
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 to check if a given string is a palindrome |
How to check whether a given year is a leap year using php. |
