Exercise 4 - Probability

  1. A coin is tossed 4 times. Write a program, to calculate probability of getting
    • exactly four heads
    • at least two heads
    • no heads
    Compare your results with the analytic solutions.

  2. A pair of dice is tossed. Write a program to find the probability of getting 6:6.
    Compare your results with the analytic solutions.

  3. A fair dice is tossed 7 times. Write a program to find the probability of getting:
    • exactly four ONE
    • at least four ONE
    • no ONE
    Compare your results with the analytic solutions.

  4. A woman has N children, the probability of each child being female is 50%.
    Copy the program below and modify it to determine the probability of all the N children being female.
    Write a program to determine the probability for N = 1, 2, 3, .... 12.
    Compare your results with the analytic solutions.
    
    PROGRAM Births
    !--------------------------------------------------------
    ! This program takes random numbers (generated uniformly
    ! between 0. and 1.)  and assigns  the sex of a child as
    ! either  male (M)  or  female (F)  according  to  a 50%
    ! probability for each case.
    !--------------------------------------------------------
      IMPLICIT NONE
      INTEGER :: I
      CHARACTER(1) :: Sex
      REAL :: R
      DO I = 1, 6
        CALL RANDOM_NUMBER(R)
        IF (R < 0.5) THEN
          Sex = "M"
        ELSE
          Sex = "F"
        END IF
        PRINT *, Sex
      END DO
    END PROGRAM Births