Computer Science, asked by sanikasclass8kvschoo, 1 month ago

write an algorithm to check a number is divisible by 8 or not...
answer this question...I'm getting confused..
please write it in steps...​

Answers

Answered by jasmitapatel60
0

Answer:

quite simple. Just take last three digits of the number and check whether these are divisible by 8. There is further simplification called 4, 2 and 1 rule. For example, you want to know whether 123456 is divisible by 8 or not. So, take last 3 digits, these are 456. Now, compute 4*4 + 5*2 + 6 = 32. As 32 is divisible by 8, the number 123456 is divisible by 8.

Those who want to know how the rule of 4, 2 and 1 has been arrived. It is amazingly simple. If we divide 100 by 8, we get remainder of 4. If we divide 10 by 8, we get 2. The last digit is taken as it is. Thus, the rule of 4, 2 and 1 is remarkably simple to understand and arrive.

Why we need to take only last three digits?

If you divide 1000 by 8, the remainder is 0. So, you need to consider only last three digits. In the above example, we can write 123456 = 123*1000 + 456. As 1000 is divisible by 8, we need to consider 456 only.

mark me as brainlist pls pls pls pls pls pls pls pls pls pls pls pls pls pls

Similar questions
English, 9 months ago