5
Contributors
4
Replies
6
Views
9 Years
Discussion Span
Last Post by shinnxennosagga
0

Hello,
do you knew java to help me.

yes... Java is a brand of coffee.
If you want help with your coding, start a new thread, provide us with the info:
- what does it need to do
- what have you allready done
- where are you stuck
and all additional info you think you need to share with us.
also, do not forget to show your code (formatted, if possible)

0

There are several forms of a recursive function, here are some :

recurveFunc(<param>) {
     <type> result;

     if (<terminate condition>) {
          return <value_returned_when_the_function_ends>;
     }
     else {
         result =  recurveFunc(<param>-1);
    }

     return result;
}
recurveFunc(<param>) {
     <type> result;

     for(int i = 0; i < <param>; i++) {
          result =  recurveFunc(<param>-1);
     }

     return result;
}

for your problem, I think second form would work, but of coure you might want to replace the FOR loop wih WHILE or DO..WHILE.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.