Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Message-ID | <4EE69C7E.12EB@mindspring.com> (permalink) |
|---|---|
| Date | 2011-12-12 19:29 -0500 |
| From | pete <pfiland@mindspring.com> |
| Organization | PF |
| Newsgroups | comp.lang.c |
| Subject | Re: Toughest Probability Question |
| References | <9cb0f967-18d1-410c-9074-f4d84858d9af@u10g2000prl.googlegroups.com> |
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 <stdio.h>
#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
Back to comp.lang.c | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Toughest Probability Question pete <pfiland@mindspring.com> - 2011-12-12 19:29 -0500
Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-13 04:46 +0000
Re: Toughest Probability Question Geoff <geoff@invalid.invalid> - 2011-12-12 22:19 -0800
Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-13 09:19 +0000
Re: Toughest Probability Question "BartC" <bc@freeuk.com> - 2011-12-13 13:43 +0000
Re: Toughest Probability Question Keith Thompson <kst-u@mib.org> - 2011-12-13 10:27 -0800
Re: Toughest Probability Question "BartC" <bc@freeuk.com> - 2011-12-13 19:52 +0000
Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-13 20:06 +0000
Re: Toughest Probability Question Keith Thompson <kst-u@mib.org> - 2011-12-13 12:14 -0800
Re: Toughest Probability Question "BartC" <bc@freeuk.com> - 2011-12-13 23:34 +0000
Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-14 00:24 +0000
Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-13 19:27 +0000
Re: Toughest Probability Question "BartC" <bc@freeuk.com> - 2011-12-13 23:56 +0000
Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-14 00:24 +0000
Re: Toughest Probability Question "BartC" <bc@freeuk.com> - 2011-12-14 12:12 +0000
Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-14 17:47 +0000
Re: Toughest Probability Question gordonb.qunma@burditt.org (Gordon Burditt) - 2011-12-15 08:22 -0600
Re: Toughest Probability Question Robert Wessel <robertwessel2@yahoo.com> - 2011-12-15 14:41 -0600
Re: Toughest Probability Question superpollo <superpollo@tznvy.pbz> - 2011-12-15 19:14 +0100
Re: Toughest Probability Question Keith Thompson <kst-u@mib.org> - 2011-12-14 13:12 -0800
Re: Toughest Probability Question Willem <willem@toad.stack.nl> - 2011-12-14 21:53 +0000
Re: Toughest Probability Question "BartC" <bc@freeuk.com> - 2011-12-14 22:35 +0000
Re: Toughest Probability Question Willem <willem@toad.stack.nl> - 2011-12-15 09:07 +0000
Re: Toughest Probability Question Geoff <geoff@invalid.invalid> - 2011-12-15 02:07 -0800
Re: Toughest Probability Question Keith Thompson <kst-u@mib.org> - 2011-12-15 12:13 -0800
Re: Toughest Probability Question Geoff <geoff@invalid.invalid> - 2011-12-15 13:03 -0800
Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-15 21:36 +0000
Re: Toughest Probability Question Geoff <geoff@invalid.invalid> - 2011-12-13 16:35 -0800
Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-14 01:20 +0000
Re: Toughest Probability Question Keith Thompson <kst-u@mib.org> - 2011-12-13 16:44 -0800
Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-14 01:20 +0000
Re: Toughest Probability Question James Dow Allen <jdallen2000@yahoo.com> - 2011-12-15 02:33 -0800
Re: Toughest Probability Question gwowen <gwowen@gmail.com> - 2011-12-15 05:38 -0800
Re: Toughest Probability Question Thad Smith <ThadSmith@acm.org> - 2011-12-18 23:34 -0700
Re: Toughest Probability Question Bill Reid <hormelfree@gmail.com> - 2011-12-14 07:07 -0800
Re: Toughest Probability Question Kaz Kylheku <kaz@kylheku.com> - 2011-12-13 06:55 +0000
Re: Toughest Probability Question Seebs <usenet-nospam@seebs.net> - 2011-12-13 09:19 +0000
Re: Toughest Probability Question pete <pfiland@mindspring.com> - 2011-12-13 12:15 -0500
Re: Toughest Probability Question pete <pfiland@mindspring.com> - 2011-12-13 13:20 -0500
Re: Toughest Probability Question Peter Nilsson <airia@acay.com.au> - 2011-12-13 18:15 -0800
Re: Toughest Probability Question pete <pfiland@mindspring.com> - 2011-12-13 21:52 -0500
csiph-web