code to check the probability of error on an election

I’m Brazilian, so I’ve translated myself the assignment file, so if there’s any mistake or anything that’s confusing please let me know. The code should be written in C. The function names should be kept  in Portuguese.n Also, it would be better if the code came with a commented explanation of how it works.