Computer Science, asked by sadaffarheen20, 2 months ago

write a program to check if a number is divisible by 2 and 4 using if else, logical AND operator​

Answers

Answered by nencygarg61
2

Answer:

* C program to check divisibility of any number

*/

#include <stdio.h>

int main()

{

int num;

/* Input number from user */

printf("Enter any number: ");

scanf("%d", &num);

/*

* If num modulo division 2 is 0

* and num modulo division 4 is 0 then

* the number is divisible by 2 and 4 both

*/

if((num % 2 == 0) && (num % 4 == 0))

{

printf("Number is divisible by 2 and 4");

}

else

{

printf("Number is not divisible by 2 and 4");

}

return 0;

}

Similar questions