in reply to New student, can we write this program in perl...
There was recently a thread on the odd/even topic here: Subroutine Even/Odd.