Recursive functions (Basic) Please Help!!

I'm struggling with solving four basic recursive functions such as the ones below. I know the set up for these are fairly similar so any help would be much appreciated!!

1. Write a function which prints all the numbers between 2 and N-1 inclusive where N is one of the parameters. i.e. part1(8) would give 2 3 4 5 6 7

2. Write a function which returns as its result the sum of all the numbers between 2 and N-1 inclusive where N is one of the parameters. i.e. part2(8) is equal to 27

3. Write a function which returns as its result the number of divisors of N that are between 2 and N-1 inclusive where N is one of the parameters. i.e. num_divisors(8) is equal to 2 because 8 is divisible by 2 and 4 but not by 3, 5, 6, or 7.

4. Write a function which takes one parameter N and returns as its result true if N is prime and false if it is not. (N is print if it has no divisors between 2 and N-1) i.e. prime(8) is equal to false.
Hello DanielleL21,

Do not double post on the same topic, http://www.cplusplus.com/forum/beginner/215085/ you should delete this post so as not to confuse people.

There are many posts here on recursion and finding prime numbers. Do a search and see what you come up with.

You may also want to research prime numbers. As to point 1; 4 and 6 are not prime numbers.

Hope that helps,

Andy
Topic archived. No new replies allowed.