/**********************************************************/
//odds.cpp 
//Written by: R. A. Hillyard
//Last Modified 09/24/2001
// 
//Program to compute the odds of hitting the jackpot when the 
//number of matches and the range are input by the user.
//For example what are the odds of picking 6 out of 50???
/*********************************************************/

#include<iostream>

using namespace std;

int main()
  {
  long odds;
  int i;
  int range;
  int num;

  cout << " enter a range: ";
  cin >> range;
  cout << " enter number to match: ";
  cin >> num;
  
  odds = 1;
  for (i=num; i > 0; i--)
    {
    odds = odds * range / i;
    range--;    
    }
  cout << "odds are " << odds << " to 1\n";
  return 0;
  }//end main

/**********************************************************
 enter a range: 10
 enter number to match: 2
odds are 45 to 1

*/