Interview Question: Factorial Computation

Sample Question #241 (programming – Matlab)
How do you calculate the factorial 10! in Matlab?
(Comment: Factorial is such a basic concept that you should already know it if you want to be a quant!)
This entry was posted in Sample Qs. Bookmark the permalink.

2 Responses to Interview Question: Factorial Computation

  1. Brett says:

    Were you thinking of doing a loop? Wrong! In Matlab, you should always try to do things in vectors or matrices first.
    The simple Matlab code is:   prod(1:10)
    The function prod() when applied to vectors simply multiplies together the elements of the vector.

  2. Unknown says:

    Also, factorial(N) does the same thing as well.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s