write a 'C' programme to check whether a number is even or odd
Answers
Answered by
2
Hi
#include <stdio.h>
#include<conio.h>
int main()
{
int a;
printf("Enter a: ");
scanf("%d", &a);
/* logic */ if (a % 2 == 0) {
printf("The given number is EVEN");
}
else {
printf("The given number is ODD");
}
return 0;
}
--》Program Output:
Enter a: 2
The given number is EVEN
#include <stdio.h>
#include<conio.h>
int main()
{
int a;
printf("Enter a: ");
scanf("%d", &a);
/* logic */ if (a % 2 == 0) {
printf("The given number is EVEN");
}
else {
printf("The given number is ODD");
}
return 0;
}
--》Program Output:
Enter a: 2
The given number is EVEN
Similar questions