Write program that implements a function with the following header to display all
the even digits in an integer:
void displayEven(int number)
For example, displayEven(345) displays 4. Write a test program that prompts the
user to enter an
integer and displays the even digits in it. Using User define functions
Sample output:
Enter an integer: 123456789
8 6 4 2
#include <iostream>
using namespace std;
    int displayEven(int n){
        int r;
       while (n>0){
        r=n%10;
        n=n/10;
        if (r%2==0)
            cout<<r<<" ";
       }
};
int main()
{
    int n;
    cout<<"Enter a number "<<endl;
    cin>>n;
    cout<<"Even Numbers"<<displayEven(n);
    return 0;
}
Comments