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.

23rd Aug 2017, 12:11 PM
Favour Onwuchekwa
3 odpowiedzi
+ 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. ✔
23rd Aug 2017, 5:22 PM
Rrestoring faith
Rrestoring faith - avatar
+ 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...
23rd Aug 2017, 12:49 PM
Joni Jimenez
Joni Jimenez - avatar
0
use regular expression for the last digit ( .*). gets the 12345. .*(.) gets that last digit
24th Aug 2017, 1:44 AM
Sam Tezel
Sam Tezel - avatar