Created
July 13, 2021 07:30
-
-
Save Irene-24/d7b8ea0b4c6a992dac27e37227f8ee4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
isEven(N):- | |
0 is mod(N,2). | |
countEvenOdd([],[0,0]). | |
countEvenOdd([H|C],[Even,Odd]):- | |
countEvenOdd(C,[E,O]), | |
( isEven(H) -> | |
Even is E+1,Odd is O+0; | |
Even is E+0, Odd is O+1 | |
). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment