#include <iostream>
using namespace std;
void printDigitsDivisibleBy2(int number);
int main(){
int number;
cout << "Enter integer number: ";
cin>>number;
printDigitsDivisibleBy2(number);
system("pause");
return 0;
}
void printDigitsDivisibleBy2(int number){
while(number>0){
int digit = number % 10;
number = number/10;
if (digit%2==0){
cout<<digit<<" is divisible by 2.\n";
}
}
}
Comments
Leave a comment