PROGRAM BT1_11 REAL LAMDA PARAMETER (NMAX=12,LAMDA=137.0/100.0) DIMENSION PK(0:NMAX) INTEGER N,K N=4 DO K=0,N PK(K)=POSSION(LAMDA,K) ENDDO WRITE(*,'(" TRUNG BINH MOT NAM CO ",F4.2," NGAY CO MUA DA")')LAMDA WRITE(*,*)' XAC SUAT TRONG MOT NAM CO: ' DO K=0,N WRITE(*,'(I3," NGAY CO MUA DA= ",F8.4)')K,PK(K) ENDDO END FUNCTION POSSION(LAMDA,K) REAL LAMDA ! HAM NAY TINH XAC SUAT SU KIEN XUAT HIEN K LAN THEO POSSION POSSION=EXP(-LAMDA)*LAMDA**K/FAC(K) RETURN END FUNCTION FAC(N) ! TINH N! (N GIAI THUA) REAL TMP IF (N.LT.0) THEN WRITE(*,*)' INVALID NUMERIC INPUT IN FAC FUNCTION' STOP ELSE IF (N.EQ.0.OR.N.EQ.1) THEN FAC=1.0 RETURN ELSE TMP=1.0 DO I=2,N TMP=TMP*REAL(I) ENDDO FAC=TMP RETURN ENDIF END