1#include <stdio.h>
2int main() {
3 int num;
4 printf("Enter an integer: ");
5 scanf("%d", &num);
6
7 // True if num is perfectly divisible by 2
8 if(num % 2 == 0)
9 printf("%d is even.", num);
10 else
11 printf("%d is odd.", num);
12
13 return 0;
14}
15
1#include <stdio.h>
2int main() {
3 int num;
4 printf("Enter an integer: ");
5 scanf("%d", &num);
6
7 // true if num is perfectly divisible by 2
8 if(num % 2 == 0)
9 printf("%d is even.", num);
10 else
11 printf("%d is odd.", num);
12
13 return 0;
14}
1/* Program to check if number is even or odd
2 * using bitwise operator
3 */
4#include<stdio.h>
5
6int main()
7{
8 int n;
9
10 printf("Enter an integer: ");
11 scanf("%d",&n);
12
13 if ( n & 1)
14 printf("%d is an odd number", n);
15 else
16 printf("%d is an even number", n);
17
18 return 0;
19}