Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: how to get the last digit of a number and add 1 to it?!

1. ## how to get the last digit of a number and add 1 to it?!

ok so I have 30568

in ASP how do i get the last digit eg here it is 8

Then I want to change this to a 9 by adding 1

2. Hi,
I usually don't like to answer with another question but in this case I think it might help you get a jump start...

When you found your answer for the example you provided, how did you go about it mathematically?

Now... assuming you found that using mod, google is always your best option to find your answer (and this well before posting) ...

That said, try the following search: asp mod function

you should find exactly what you need from there!

hope this helps!

Have a nice day!

3. I doubt seriously that Jarv found it mathematically, at all.

I'm sure he just looked at the string of digits and picked out the last one.

My question to Jarv is more fundamental:

30568
last digit is 8
bump it by 1 and it is 9

30569
last digit is 9
bump it by 1 and it is 10

Is *THAT* what you want????

Or do you want
30569
last digit is 9
bump it by 1 and it is 10, but then you only want the last digit of that so answer is 0.

Is *THAT* what you want???

Finally, when you get the last digit bumped by 1, do you want to put it back on the end of the number???

That is, do you *REALLY* want
30568 ==>> 30569
30569 ==>> 30560
???

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•