Question: Create a simple math program that can tell if a large number is evenly divided by 2 version 1 : is the last string digit

Create a simple math program that can tell if a large number is evenly divided by
2
version 1: is the last string digit even (0,2,4,6,8)
version 2: look at last bit and see if it is 0
3
summing the digits until it is a single digit
is the sum of all the digits 0,3,6, or 9
4
Version 1
is the last string digit even (0,2,4,6,8)
divide by 2(convert to number, divide, return to string)
is the new value even
version 2
look at last bit, is it 0
bit shift left
is the last bit 0?
version 3
bit & 3-- this masks the last 2 bits...
5
Last string digit is "0" or "5"
6
last string digit is even
divides by 3
8
Version 1
is the last string digit even (0,2,4,6,8)
divide by 2(convert to number, divide, return to string)
is the new value even
divide by 2(convert to number, divide, return to string)
is the new value even
version 2
look at last bit, is it 0
bit shift left
is the last bit 0?
bit shift left
is the last bit 0?
version 3
are the last 3 bits 000-- this masks the last 3 bits ( not( bit & 7))
9
version 1
is if divisible by 3(see above)
divide by 3
is the new result divisible by 3
version 2
using the algorithm for divide by 3, test to see if the final single digit string is 0 or 9
Each digit is 5 points maximum, See the Rubric for weights. Each digit should have its own function. (Reuse of code)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!