• Post Reply Bookmark Topic Watch Topic
  • New Topic

interation and evaluation  RSS feed

 
Anna Parsons
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to iterate a number with multiple digits and determine if there is an odd digit.
Can't seem to get the iteration part down.

 
Tim Cooke
Marshal
Posts: 4051
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Anna, welcome to the Ranch!

When posting code it's recommended to UseCodeTags (<- click link) to make your code nice and easy to read. I've added them for you this time.

What exactly is the problem you're having just now? I'm going to say it's a compilation error, so let's see what it says.
 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you having trouble looking at one digit at a time? Try a combination of number % 10 and number / 10 and see how that works.

And do you really want a while loop? Are you looping or deciding?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!