<?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 simple PHP script that calculates the sum of all even numbers between 1 and 10. |
Write a PHP script that generates a random password of a specified length. |
Write a PHP script that sets a cookie with user preferences and retrieves it on subsequent visits. |
Create a PHP script that uses sessions to store and display user information. |
how to get current latitude and longitude using google map api in php? |
Create a PHP script that processes a form submission and displays the submitted data. |
Write a PHP script that parses JSON data and displays specific information. |
How to convert a temperature from Celsius to Fahrenheit using php. |