picking out a number from an integer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vix290788
    New Member
    • Oct 2008
    • 4

    picking out a number from an integer

    How would you go about selecting a number from an integer and then displaying it on the screen. So, if the user enters an integer N, say 36723 and then you want the 3rd digit displayed on screen, what code would you need to display the 7 (3rd digit)?
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #2
    If you take integer 36723 and divide by 10 what happens? If you take the same integer and do mod 10 to it what happens?

    Certainly with those two tools you should be able to come up with something?

    Comment

    • archonmagnus
      New Member
      • Jun 2007
      • 113

      #3
      If you don't have to store the input as an integer, you could store it as a string or a character array. That may be easier in displaying a specific character index value.

      Comment

      Working...