How to Check whether a number is even or Odd. Here is the Simple C Program To Check Even Odd Numbers Using Simple If Else.
Logic:
no1%2 will give '0' for Even Number and
Any other number for Odd Numbers.
Source Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int no1,x;
printf("Enter any number\n");
scanf("%d",no1);
x=no1%2;
if(x==0)
printf("%d is an Even Number",no1);
else
printf("%d is an odd Number",no1);
return 0;
}
Note:
Any Question!!??
"Feel Free To Ask In Comments"
Like and Share or Follow us on Facebook and Instagram for more Programs Codes ;).
"Feel Free To Ask In Comments"
Like and Share or Follow us on Facebook and Instagram for more Programs Codes ;).
Email Us or inbox us to get Your Programs done :)
No comments:
Post a Comment