I'm trying to resolve this problem.
Numbers whose sum of digit divible by 3 represent number divisible by 3.
Write a program to verify this famous statement.
Input a 5-digit interger n from the keyboard.
Find the sum of digits. Call it sum.
Verify the either (a)both n and the sum are divisible by 3 or (b)both are indivisible by 3.
Your output is:
Given number n = ...
Print one of the following three statement:
(a)Both n and sum are divisible by 3.
(b)Both n and sum are indivisible by 3.
(c)The famous statement is wrong
I'm getting Incompatible type error when I run the code below on if(g = 0).
My questions are:
1) on if(g = 0), I thought 0 is a int. What is wrong with g = 0.
2) How do I capture n in a variable and test if it divisible by 3. For example: if I type in 58973 on the key borad, I would like to capture this intergers in a variable. Does anyone knows what's happening here. Please help
Regards
Ken