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) { cout<<"number is even"; } else { cout<<"number is odd"; } } void main() { int a; clrscr(); cout<<"enter a number"; cin>>a; evenodd(a); //calling or invoking the function getch(); }