Important News

We have released Shinobi Life Online Pre-Alpha Version 1.1.0.0! This update features Earth Release: Earth Dome Jutsu, Aiming Mode and more! Try it out and tell us what you think.

User

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

Discord

Statistics

Members
Total Members: 55245
Latest: adonis
New This Month: 22
New This Week: 3
New Today: 0
Stats
Total Posts: 55921
Total Topics: 3275
Most Online Today: 2673
Most Online Ever: 26696
(March 25, 2026, 17:42:18)
Users Online
Members: 0
Guests: 2529
Total: 2553
Google (AdSense) (7)
Google (15)
Baidu (2)

Author Topic: Recursion Program.  (Read 24552 times)

0 Members and 1 Guest are viewing this topic.

Offline Kakashi Natsu

  • Special Jonin Donator
  • Chunin Poster
  • ***
  • Posts: 145
  • Reputation Power: 2
  • Kakashi Natsu has no influence.
  • Gender: Male
    • View Profile
  • Clan: Agni
Recursion Program.
« on: March 25, 2017, 02:56:41 »
So a friend asked me to help him with a program using Java. SO being a good friend, i did. Unknowingly i got myself into a heap of trouble... getting into recursion. Now for some of you, you may not know what recursion is in programming. Well here is an example of a factorial.
[/size]
[/size]
Code: [Select]





//will return an integer
number = 0;


Integer factorial(integer n){
if(n==0){
return number
}
number = n*factorial(n-1)




}
//lets call up this routine
factorial(3)
//this is 6 btw.



[/size]
[/size]So This is a simple version of a recursive program, where in the program itself, it calls itself up. Confusing but very helpful when it comes to path finding. For those that have a JDK and can run Java. To see the program i helped my friend with, click on the zip folder->https://jetfire3201.000webhostapp.com/ and run it in netbeans or eclipse. Main program is in Easterbunny.java.



Offline ThatsHawt

  • Academy Student Poster
  • *
  • Posts: 1
  • Reputation Power: 2
  • ThatsHawt has no influence.
  • Gender: Male
  • I'm new around here.
    • View Profile
Re: Recursion Program.
« Reply #1 on: October 01, 2017, 06:22:40 »
in your factorial method, you should return an int instead of an Integer.
Every time you run this method it creates an Integer object which is a waste of space when you can just return an int.
  • Character Name: Hawt

 

Recent Topics

U4N Examines What Makes MapleStory Classic World Feel Authentic by adonis
September 22, 2026, 07:28:55

U4N Reviews Ranger Strengths Across Aion 2 PvP and PvE by adonis
September 22, 2026, 07:28:03

Material, Technology, and Design in Chocolate Milling Equipment by jsszgusufood
September 22, 2026, 07:27:58

U4N Previews What the Frozen Trail Update Means for ARC Raiders by adonis
September 22, 2026, 07:26:52

Hand Seal Proficiency leading to Improved Jutsu Damage by Kakashi Natsu
April 02, 2026, 15:04:40

Agni by Kakashi Natsu
March 22, 2026, 19:22:09

Fengshui Clan by mamita
March 14, 2026, 21:31:07

Kazuki Raiu by Leebz
February 11, 2026, 22:56:31

Acrobatics by mamita
January 23, 2026, 17:06:01

Shinobi Life Hunger Games by mamita
January 23, 2026, 17:04:48

Top Posters

Mars
Posts: 2637
Reminance
Posts: 2232
Shivraj
Posts: 1610
m4r1us
Posts: 1298
Manuster
Posts: 1265
NinjaMirage
Posts: 1165
Nova
Posts: 1139
taigakun
Posts: 1091
Fraudulent
Posts: 1084
Konohuro
Posts: 1056