Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Mon, 12 Dec 2011 18:29:59 -0600 Message-ID: <4EE69C7E.12EB@mindspring.com> Date: Mon, 12 Dec 2011 19:29:50 -0500 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.lang.c Subject: Re: Toughest Probability Question References: <9cb0f967-18d1-410c-9074-f4d84858d9af@u10g2000prl.googlegroups.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 51 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.220.183 X-Trace: sv3-qrbCO7ijQOWnBb3edFeQrhr+WBMy9DP87/zGKY5T4oz6QOYoGTl+q+NrEf20VBL+UNsMdq6hVkC/25i!PxHovFONgHKKXVAoUaJL0O32HP2kV9D1uqWkioytA/lrFDeJjVj65tB40xKVPz4GMOUNZNBal7na!hw67Iignk1M= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2136 Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:14536 divya bisht wrote: > > Toughest Probability Question > (Source : http://hardest-puzzle.blogspot.com/2011/12/toughest-probability-question.html > ) > > How many people must be gathered together in a room, before you can be > certain that there is a greater than 50/50 chance that at least two of > them have the same birthday? > > Discuss Solution in link below /* BEGIN output from new.c */ The probability that 23 random birthdays are all different is 0.492703 /* END output from new.c */ /* BEGIN new.c */ #include #define YEAR 365 /* 366 */ int main(void) { int days = YEAR; double probability = 1; int people = 1; puts("\n/* BEGIN output from new.c */\n"); do { ++people; --days; probability *= 1.0 * days / YEAR; } while(probability > 0.5); printf("The probability that %d " "random birthdays are all different is %f\n", people, probability); puts("\n/* END output from new.c */"); return 0; } /* END new.c */ -- pete