Need help with Recursion Program today!!!!

M

mich5973

I have been given assignment to create a program named count. This
program is to count from 1 to the number being given which is supposed
to be the variable N. Another thing, the program can have only one
parameter. Does anyone have an idea how to write this program. I
really need help!!!!!!
 
J

John W Kennedy

I have been given assignment to create a program named count. This
program is to count from 1 to the number being given which is supposed
to be the variable N. Another thing, the program can have only one
parameter. Does anyone have an idea how to write this program. I
really need help!!!!!!

Assuming that the "Recursion" in your subject line is part of the
assignment, here is the middle:

if (i >= 1)
run(i - 1);
System.out.println(i);

Now build what goes around it.


--
John W. Kennedy
"When a man contemplates forcing his own convictions down another
man's throat, he is contemplating both an unchristian act and an act of
treason to the United States."
-- Joy Davidman, "Smoke on the Mountain"
 
M

mich5973

i still dont understand my teacher hasn explained to me how to do this
and im just lost
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top