Over 1M Posts • 84K Topics • 9K Authors

anyone know Java - 6G Celicas Forums

Topic #33780 6 posts Started by Celicaca
I am new to java and wanted to figure out an example we did in class but i cant do it. i was wondering if anyone could point me in the right direction. it's a really simple program...i just cant figure out how to do it lol cause im new.

i want the program to ask the user to enter 2 integers. and then print out all the integers between the 2 numbers. thats all. i know i need a while statement and some kind of counter, but i dont know how to do it.

if anyone can even show me the simple prog maybe i could just study it and learn. ty
I did some java in college.... might can help.. idk







~Daniel~ No Longer Celica Owner.. moved on to a 03 WRX-EJ207
I know some Java. Basically, you could use java.util.Scanner's nextInt() function for accepting user input.

Then to print out all of the integers between the two numbers, you could do something like this:

1. Determine the smaller number(or if they're the same, in which case you'd output a message saying so.)

2. Increment your smaller number by one(So you don't include the user's entered number in your output.)

3. While the smaller number is less than the larger, print the smaller number and increment the smaller number by one.

That's basically all you need to do. Shouldn't be too hard. smile.gif

New Toyota project coming soon...
I know Jawa

user posted image

my st205 swapandour Beams swap
>
QUOTE(Coomer @ Feb 14, 2006 - 4:11 AM) [snapback]393470[/snapback]
>
I know some Java. Basically, you could use java.util.Scanner's nextInt() function for accepting user input.

Then to print out all of the integers between the two numbers, you could do something like this:

1. Determine the smaller number(or if they're the same, in which case you'd output a message saying so.)

2. Increment your smaller number by one(So you don't include the user's entered number in your output.)

3. While the smaller number is less than the larger, print the smaller number and increment the smaller number by one.

That's basically all you need to do. Shouldn't be too hard. smile.gif


yea i know what to do basically, i just cantactually do it lol but yea, ill keep trying. thankey

This post has been edited by Celicaca: Feb 14, 2006 - 12:55 AM
i always wanted to get back into programming. I miss C++ and Java.

To live, is to sufferTo survive, thats to find meaning, in the suffering....