Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int cifMaxPar(int numar)
- {
- if(numar < 10) {
- if(numar % 2 == 0)
- return numar;
- else
- return -1;
- }
- else {
- if(numar % 2 == 1) // ultima cifra este impara
- return cifMaxPar(numar / 10);
- else
- return max( numar % 10, cifMaxPar(numar / 10) );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement