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!

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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Matlab: factorials without for loops or colon
  1. For loops in Matlab (Replies: 22)

  2. MatLab for loops (Replies: 3)

Loading...