## C.d.f. of the number of heads in n coin tosses n <- 5 x <- 0:n y <- cumsum(choose(n,x)/2^n) png(filename="cdf_hnt.png") plot(x,y) x1 <- c(-100, x) y1 <- c(0, y) x2 <- c(x, 100) segments(x1,y1,x2,y1) title(paste('C.d.f for the number of heads in n=', n,' trials')) dev.off();