aspose file tools*
The moose likes Beginning Java and the fly likes odd numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "odd numbers" Watch "odd numbers" New topic
Author

odd numbers

john craig
Greenhorn

Joined: Oct 30, 2003
Posts: 1
I have just started Java and have been given a small problem "create a class to output the values of the first ten odd numbers. Could anyone help please?
JMC
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

Hi John,
Welcome to JavaRanch!
Use a "for" loop. Start at 1 and increment the counter by 2, ten times.


[Jess in Action][AskingGoodQuestions]
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

[ partial homework solution removed -ds ]
[ October 30, 2003: Message edited by: Dirk Schreckmann ]

Please ignore post, I have no idea what I am talking about.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Please don't post solutions to homework help requests. 'Round these parts we like to encourage learning and helping others to discover how to solve problems.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

Normally I don't post any code at all. But lately I have been seeing people posting code right and left - just trying to join the crowd. (And the code wouldn't have compiled.)
And I changed my sig.
[ October 30, 2003: Message edited by: William Barnes ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30


And I changed my sig.

Thank you. You're a gentleman and a scholar.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: odd numbers
 
Similar Threads
Sun ... Java ... Marketing ... engineering cartoon
Odd numbers
Printing Diamon in java
[medium]Challenge the mathematicians
Fibonacci Sequence Problem