C program to check the given number is even or odd
kw.c
#include<stdio.h>intmain(){intn,a;printf("———————————————————————————————————————————");printf("\nProgram for even-odd test of a given number");printf("\n———————————————————————————————————————————");printf("\nEnter a number ");scanf("%d",&n);if(n%2==0){printf("\n%d is EVEN number",n);}else{printf("\n%d is ODD number",n);}printf("\n———————————————————————————————————————————\n");return0;}
Output
kodingwindow@kw:~$ gcc kw.c kodingwindow@kw:~$ ./a.out
———————————————————————————————————————————
Program for even-odd test of a given number
———————————————————————————————————————————
Enter a number -5005
-5005 is ODD number
———————————————————————————————————————————
kodingwindow@kw:~$ ./a.out
———————————————————————————————————————————
Program for even-odd test of a given number
———————————————————————————————————————————
Enter a number 5050
5050 is EVEN number
———————————————————————————————————————————
kodingwindow@kw:~$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.