1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Matlab: factorials without for loops or colon

  1. Oct 9, 2012 #1
    The Problem: Write a function that finds the factorial of a positive integer without using for or while loops, the factorial function, or the : range operator.

    Honestly, I don't really know how to start with this one. If I were able to use a for loop it would be easy, and I don't see how I can do this with conditionals. Any ideas/hints?
     
  2. jcsd
  3. Oct 9, 2012 #2

    jhae2.718

    User Avatar
    Gold Member

    Think recursion.
     
  4. Oct 9, 2012 #3
    Ooh, thanks. I got it.
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook