Check whether an integer entered by the user is odd or even with C language
#include <stdio.h>
int main()
{
int num;
printf("Enter a num: ");
scanf("%d", &num);
if (num % 2 == 0)
printf("%d is an even .", num);
else
printf("%d is an odd .", num);
return 0;
}
Output:-
Enter a num: 45
45 is an odd .
0 Comments