Write a program to check if a number is divisible by 2 or not.
// program to check if a number is divisible by 2 or not.
#include<stdio.h>
#include<math.h>
int main()
{
int x;
printf("enter a number");
scanf("%d", &x);
printf("%d\n", x%2==0);
// if the number is divisible by 2 then the output will be 1(true)
// if the number is not divisible by 2 then the output will be 0(false)
return 0;
}
Comments
Post a Comment
Please do not enter any spam link in the comment box.