• Post Reply Bookmark Topic Watch Topic
  • New Topic

display numbers between 1 to 100  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
I need help on a homewrok, please!
How to write a program displaying complete numbers between 1to100?
Thanks a lot!
 
author
Marshal
Posts: 23439
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Pretty straightforward assignment. What have you done so far? What issue are you running into (that is blocking you)? ... and to get a little deeper, have you learned loops yet?

Henry
 
Amin Shirzad
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Henry Wong wrote:
Pretty straightforward assignment. What have you done so far? What issue are you running into (that is blocking you)? ... and to get a little deeper, have you learned loops yet?

Henry



Thanks a lot for replying!
Yea, I've learned loops but I don't know how to write such a program! Would you please help me in writing it? I think it will be a few lines...
And of my bad fortune, I don't have enough time to focus on it!
 
Henry Wong
author
Marshal
Posts: 23439
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Amin Shirzad wrote:
And of my bad fortune, I don't have enough time to focus on it!



Yeah, you are gonna to need to show a bit more effort. We can't give you a hint in the right direction, if we can't tell what you have done so far.

Anyway, if the issue is getting started, generally, using a previous assignment as a template is a good option -- as that has already established a class with a main() method.

Henry
 
Ranch Hand
Posts: 529
3
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use for loop to achieve that. There are lot of example from Internet 
 
Ranch Hand
Posts: 51
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To display numbers you can use System.out.println() which prints them to console. Or you can display them on swing JOptionPane.showMessageDialog(...).
 
lowercase baba
Bartender
Posts: 12613
50
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
of course, you can also simply use a single println statement and one string literal.

or 100 println statements.
 
Marshal
Posts: 5593
384
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Amin Shirzad wrote:And of my bad fortune, I don't have enough time to focus on it!


From this quote take some important lesson too. you should have start that earlier. After all, without even starting and not knowing how long solution is, don't say you don't have enough time. Do you know roughly how much time is needed here?

If there were some serious problems you have had which prevented you from allocating enough time for assignment - apply for mitigating circumstances. If those don't get confirmed, means it is your fault in managing your time - which is a skill you need to learn too.

 
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, you need a loop to go from 1 to 100 and second, you need a method that will print those numbers as you through the loop.
 
Liutauras Vilda
Marshal
Posts: 5593
384
BSD
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vitalii is right, there are 2 basic steps you need to do. Search through your learning materials, there should be some examples.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!