This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trying to look at only at the number in the "ones" digit place

 
Paul Hobson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a some numbers, all of them ranging from 1-100. Is there a code to look at only the number in the one's place. like for the number 96; make it only look at the number six. like i want to make a variable equal to whatever number is in the one's place. if anyone knows how to do this it would be greatly appreciated.
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use the mod (remainder) function you can do what you want.
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Hobson:
I have a some numbers, all of them ranging from 1-100. Is there a code to look at only the number in the one's place. like for the number 96; make it only look at the number six. like i want to make a variable equal to whatever number is in the one's place. if anyone knows how to do this it would be greatly appreciated.

Looks like a home work!
Here is a hint: Use Modulo Division
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic