home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / DA / P / Pica Calculator 2 / PC2 Folder / PC2 Sample Pgms / PC2 Sample Pgms.rsrc / TEXT_23885_Combinations.txt < prev    next >
Encoding:
Text File  |  1993-07-16  |  1.4 KB  |  21 lines

  1. The "Combinations" program is both a fun and useful program. 
  2. It is an adaptation from an example given in the TI-57 programming guide.
  3.  
  4. From a given number of elements in a set it computes the number of possible combinations of a subset of elements without repetition. An example of this is a deck of playing cards. There are 52 cards in the deck, playing hands are delt out in groups of five, since no two hands are the same, how many possible hands are there?
  5.  
  6. 2,598,960
  7.  
  8. The "Combinations" program is somewhat different than the other example programs. It does not use prompt dialogs as the others do. Instead, it relies on the right values being in the display at the appropriate times. This is a carry-over from adapting a program for a hand-held calculator and is not intended to serve as a "good" example. This data entry technique can have its benefits for down and dirty programs which are used for only a brief period. For programs that you plan to keep, using prompt dialogs can make their operation easier to remember.
  9.  
  10. Here is a walk-thru example for calculating the odds of the new California 6/51 State Lottery:
  11.  
  12. 1) enter the value of 51 into the calculator.
  13. 2) press the "Run" control button.
  14.    the calculator will do its thing for a while and then enter "pause" mode.
  15. 3) When paused, enter 6 into the calculator
  16. 4) press the "Cont" control button.
  17. 5) When the calculator stops the possible combinations are displayed.
  18.  
  19. The odds will be: 1 in 18,009,460
  20.  
  21.