Created
March 2, 2020 16:55
-
-
Save shivdhwaj/82e703dd62b3b7c0e3e5c79a5a950cd7 to your computer and use it in GitHub Desktop.
Find the sum of first 20 even number in PHP Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function evenSum($n) { | |
return ($n * ($n + 1)); | |
} | |
$n = 20; | |
echo "Sum of first: ". $n." even numbers is: " . evenSum($n); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment