im writing a program in the program a lage amount of numbers is inputed and i need to find which of these numbers are devisible by 3,i dont now how to finde if a number is devisible by 3 so please help.
im writing a program in the program a lage amount of numbers is inputed and i need to find which of these numbers are devisible by 3,i dont now how to finde if a number is devisible by 3 so please help.
Use the modulus operator - % and if the result is 0 then it's divisible by 3.
if( (num % 3)==0 ) /* Num is divisible by 3 */
The modulus operator (%) returns the remainder of a division. If the remainder is zero then the operand on the left side is divisible by the operand on the right side.
Code:if (number % 3 == 0) { /* Divisible by 3 */ }