Birthday Paradox Checker

Step 4 – how many people

Code image

The birthday paradox says we need 23 people in our list to expect to get a match.

But we might want to experiment with different numbers of people later on.

So, let's add that in now.

  1. Change your program as shown
  2. Use an  input line to get the user to tell you how many people are in the group

    We store this in a variable called  people
    We need to use  int to convert this in to a number
    Careful with the brackets here

  3. Then change the  for loop to be from 0 to  people
  4. Run your program to check it works (Run > Run module) using 23 people to start with

Most of the time you'll enter 23 when asked