Thread: Even or Odd (practice problem)

  1. #16
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by homer_3 View Post
    Your logic is wrong. If you passed in odd(2), 2!=1 so odd() would call even(2-1), 1!=0 so even would call odd(1-1), and next thing you know you are dealing with negative numbers, which your code doesn't handle.

    Is this warm up supposed to familiarize you with recursion?
    Aaaaaand another one who didn't read my post...

  2. #17
    Registered User
    Join Date
    Nov 2008
    Posts
    127
    Quote Originally Posted by EVOEx View Post
    Aaaaaand another one who didn't read my post...
    You know what they say about assumptions. I read it. It didn't mention recursion. I was curious if the OP took that route to solving the problem because he was doing an exercise in recursion.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. searching problem
    By DaMenge in forum C Programming
    Replies: 9
    Last Post: 09-12-2005, 01:04 AM
  2. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM
  3. Words and lines count problem
    By emo in forum C Programming
    Replies: 1
    Last Post: 07-12-2005, 03:36 PM
  4. inStream practice problem not working?
    By correlcj in forum C++ Programming
    Replies: 2
    Last Post: 10-27-2002, 05:58 PM
  5. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 08:37 AM