Computer Science, asked by bivamukhiya2026, 4 months ago

Write an algorithm to check whether a number is divisible by three or not

Answers

Answered by roysubhasish607
7

Answer:

Explanation:

Start the algorithm. Step 2: Read the number by the user in variable "x". Step 3:Test the condition if n mod(%) 2 equals 0 then move to Step 4 . ... Step 5: Display " Number is not divisible by 2 "

Answered by rashmimarathe929
3

Answer:

plzz follow me..... or thank me please

Explanation:

Divisibility with 9: For a number to be divisible by 9, we have to ensure that the sum of digits is divisible by 9. If the number is 72 then 7+2 = 9 and since 9 divides 9, 9 divides 72 (72 = 9*8). If the number is 936 then 9+3+6 = 18 and since 9 divides 18, 9 divides 936 (936=9*104). If the number is 1234 then it is not divisible by 9 since 1+2+3+4=10 and 9 doesn’t divide 10 and therefore 9 doesn’t divide 1234.

Divisibility with 5: For a number to be divisible by 5, the number has to end with 5 or 0. If the number is 50 then it is divisible by 5 as it is ending with zero (0). If the number is 47 then it is not divisible by 5 as it is ending with 7 and not 0 or 5.

Now, coming to coming to the combined algorithm, the number has to be ending with either 0 or 5 and the digits should add to a number such that 9 should divide that number. If the number is 1215 then since it ends with 5, 5 divides it and since 1+2+1+5=9, 9 divides 1215.

If the number is 1224 then 5 doesn’t divide it, albeit 9 divides it.

If the number is 1235 then 5 divides it, albeit 9 doesn’t divide it.

If the number is 1236 then 5 doesn’t divide it, as also 9.

If the number is 1260 then 5 divides it, as also 9.

Similar questions