<?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
Create a PHP script that checks whether a given number is a prime number or not. |
Write a PHP script that calculates the sum of digits in a given number. |
Write a PHP script that checks if a given string is a valid email address. |
Create a PHP script that processes a form submission and displays the submitted data. |
Create a PHP script that uses sessions to store and display user information. |
Write a PHP script that parses JSON data and displays specific information. |
Write a PHP script that calculates the factorial of a given number. |
Create a PHP function to count the number of vowels in a string. |