C Programming Code Examples C > If Else and Switch Case Code Examples program to check whether a number is divisible by 5 and 13 or not program to check whether a number is divisible by 5 and 13 or not Write a C program to check whether a number is divisible by 5 and 13 or not using if else. How to check divisibility of any number in C programming. C program to enter any number and check whether it is divisible by 5 and 13 or not. A number is exactly divisible by some other number if it gives 0 as remainder. To check if a number is exactly divisible by some number we need to test if it leaves 0 as remainder or not. C supports a modulo operator %, that evaluates remainder on division of two operands. You can use this to check if a number is exactly divisible by some number or not. For example - if(8 % 2), if the given expression evaluates 0, then 8 is exactly divisible by 2. Input a number from user. Store it in some variable say j. To check divisibility with 5, check if(j % 5 == 0) then j is divisible by 5. To check divisibility with 13, check if(j % 13 == 0) then j is divisible by 13. Now combine the above two conditions using logical AND operator &&. To check divisibility with 5 and 13 both, check if((j % 5 == 0) && (j % 13 == 0)), then number is divisible by both 5 and 13. #include <stdio.h> int main() { int j; /* Input number from user */ printf("Enter any number: "); scanf("%d", &j); /* * If j modulo division 5 is 0 * and j modulo division 13 is 0 then * the number is divisible by 5 and 13 both */ if((j % 5 == 0) && (j % 13 == 0)) { printf("Number is divisible by 5 and 13"); } else { printf("Number is not divisible by 5 and 13"); } return 0; }