Off course if you have a coin whose both sides are either heads or tails then it will be each time heads or tails(depending which one you have both the sides). Your code tells in if statement if condition is TRUE then print ok and when it is NOT true means go to else then also print ok , so that only it is printing each time the same. Try changing it to NOT ok etc. Let us know if you have any queries on same.