You are on page 1of 1

########################################################

# CONTADOR DE NEUTRONES #
########################################################

VA <- matrix(rnorm(2000000), 100000)


conteo <- 0
m <- 0
for(i in 1:100000){
x <- 1.1
for(j in 1:7){
x <- x+cos(pi*VA[i,j])
}
if(x>=5){
m <- m+1
}
# conteo de 1000 en 1000 #
n <- i/1000
if((i%%1000)==0){
per[n] <- (100*m)/i
if(n==1){
cat("CONTEO","\t","PORCENTAJE","\n")
}
cat(n,"\t",per[n],"\n")
conteo <- conteo+per[n]
}
}
porcentaje <- conteo/(i/1000)
cat("PORCENTAJE PROMEDIO","\t",porcentaje)

You might also like