Skip to content

Instantly share code, notes, and snippets.

@shivdhwaj
Created March 2, 2020 16:55
Show Gist options
  • Save shivdhwaj/82e703dd62b3b7c0e3e5c79a5a950cd7 to your computer and use it in GitHub Desktop.
Save shivdhwaj/82e703dd62b3b7c0e3e5c79a5a950cd7 to your computer and use it in GitHub Desktop.
Find the sum of first 20 even number in PHP Code
<?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