-->
Showing posts with label program to know a number is even or odd. Show all posts
Showing posts with label program to know a number is even or odd. Show all posts

program to know a number is even or odd using function



//program to know a number is even or odd
#include<stdio.h>
#include<conio.h>
void evenodd();
void main()
{
evenodd();
getch();
}
void evenodd()
{int x;
printf("enter a number\n");
scanf("%d",&x);
if(x%2==0)
   {
    printf("it is an even number");
    } 
else
   {
   printf("it is an odd number\n");
    }
}