Even or Odd in C program

//Even or Odd
#include <stdio.h>
int main()
{
int number;
printf("Enter an integer: ");
scanf("%d", &number);
// True if the number is perfectly divisible by 2
if(number % 2 == 0)
printf("%d is even.", number);
else
printf("%d is odd.", number);
return 0;
}


//Even or Odd Using Function

#include<stdio.h>
#include<conio.h>
void check(int);
main()
{
int n;
printf("Input a number");
scanf("%d",&n);
check(n);

}
void check(int n)
{
if(n%2==0)
printf("%d is even",n);
else
printf("%d is odd",n);

}

 

Other Related Topic

Armstrong or Not  in C program (Click Here)

Palindrome or Not in C program (Click Here)

Reverse number  in C program (Click Here)

Positive Negative or Zero  in C program  (Click Here)

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter Captcha Here : *

Reload Image