0
I'm trying to write a program that will accept a long integer as in[put and remove the last digit...click message for more info
Step 1 Enter the ticket number; for example, 123454. Step 2 Remove the last digit, leaving 12345. Step 3 Determine the remainder when the ticket number is divided by 7. In this case, 12345 divided by 7 leaves a remainder of 4. Step 4 Assign the Boolean value of the comparison between the remainder and the digit dropped from the ticket number. Step 5 Display the resultâtrue or falseâin a message box.
3 Answers
+ 2
Removing last digit can be done by dividing the number by 10.
Finding the final digit can easily be done with: number % 10.
Remainder after dividing by 7 is just number % 7.
Compare the final digit with the remainder.
Then your basically Done. â
+ 1
From what I can see, this is pretty straight forward... except for removing the last digit thing, you could hhmmmm... get the remainder of the number by dividing it by 10...
0
use regular expression for the last digit ( .*). gets the 12345. .*(.) gets that last digit