Can you help me with binomial distribution formula code? I don't know what I did wrong!
Here is the code:
var sucess = tacpo/pokusaji
var failure = 1 - sucess
var pokusaji = prompt("Koliko ukupno ima pokusaja(max tries)?");
var tacpo = prompt("Koliko ima tacnih pokusaja(success tries)?");
var numberOfTries = prompt("Koliko rundi(n)?!");
var successtries = prompt("Koliko uspesnih rundi(X)?");
var failuretries = numberOfTries-successtries
var success1 = Math.pow(parseInt(sucess),parseInt(successtries));
var fail1 = Math.pow(parseInt(failure),parseInt(failuretries))
var result = (parseInt(numberOfTries)/parseInt(successtries))success1fail1
var perc = result * 100
alert("Percentange is " + perc)
Also binomial distribution formula is:
(n/X) * success^X * failure^n-X
It's hard reading a code with no identation, please write it in code playground then share it here.
I didn't read the code yet, but I see missing semi-colons ';' at the end of decalation of many variable, try adding semi-colons and run it again.
Also, in line twelve, you wrote success1fail1 directly after parenthese ')', you forgot to put an operator there.