Skip to content

Instantly share code, notes, and snippets.

@hosamshahin
Created May 20, 2016 17:06
Show Gist options
  • Save hosamshahin/fc1a34e5d912543a3aeb9618098f79c0 to your computer and use it in GitHub Desktop.
Save hosamshahin/fc1a34e5d912543a3aeb9618098f79c0 to your computer and use it in GitHub Desktop.
public int factorial(int n)
{
int result = 1;
for (int i = 1; i <= n; i++) {
result = result * i;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment