Skip to content

Instantly share code, notes, and snippets.

@carlosbrando
Created December 12, 2015 04:20
Show Gist options
  • Save carlosbrando/be9cb99918d248caf7e6 to your computer and use it in GitHub Desktop.
Save carlosbrando/be9cb99918d248caf7e6 to your computer and use it in GitHub Desktop.
class MyTest
def factorial(n)
f = 1
n.downto(2) { |x| f *= x }
f
end
inline do |builder|
builder.c "
long factorial_c(int max) {
int i=max, result=1;
while (i >= 2) { result *= i--; }
return result;
}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment