Back To C User Defined Functions Index
//program to create a function to find whether a number is even or odd example 2 (number is passed to function as argument) #include
#include
void evenodd(int); //function declaration void evenodd(int a) //function definition { if(a%2==0) { printf("number is even"); } else { printf("number is odd"); } } void main() { int a; clrscr(); printf("enter a number"); scanf("%d",&a); evenodd(a); //calling or invoking the function getch(); }