Tracks
/
Prolog
Prolog
/
Exercises
/
Cheryl's Birthday
Cheryl's Birthday

Cheryl's Birthday

Easy

Introduction

Albert and Bernard just became friends with Cheryl, and they want to know when her birthday is. Cheryl gives them a list of 10 possible dates:

May 15, May 16, May 19 June 17, June 18 July 14, July 16 August 14, August 15, August 17

Cheryl then tells Albert and Bernard separately the month and the day of her birthday respectively.

Albert: I don't know when Cheryl's birthday is, but I know that Bernard doesn't know too. [sic] Bernard: At first I don't [sic] know when Cheryl's birthday is, but I know now. Albert: Then I also know when Cheryl's birthday is.

Instructions

Based on the 10 possible dates and the three statements, find out Cheryl's birthday.


Source

WikipediaThe link opens in a new window or tab
Edit via GitHub The link opens in a new window or tab
Prolog Exercism

Ready to start Cheryl's Birthday?

Sign up to Exercism to learn and master Prolog with 109 exercises, and real human mentoring, all for free.