The program uses the mod operator to determine the value of a digit. It then changes the costume of the digit using the value.