I have this problem which says, "A programmer can use the random feature to emulate the flipping of a coin. For example, if the generator produces a number 0 or 1, the value 0 can be assigned heads and the value 1 can be assigned tails.

Write a program that "flips" a coin 50 times. Count the number of times the result is heads. Count the number of times the result is tails."

I am using Flowgorithim (a flowchart and algorithim combo) and so far I have:

Declare Integer heads

Declare Integer tails

Declare Integer flipCoin

Declare Integer count

Display "This program emulates 50 coin tosses of heads (0) or tails (1): "

For count 1 = 1 to 50

Set heads = 0

Set tails = 1

Set flipCoin = random(2)

If flipCoin == tails Then

Set flipCoin = tails

Else

Set flipCoin = heads

End If

Display flipCoin

End For

Display "Total number of heads: ", heads

Display "Total number of tails: ", tails

Simply, I am confused on how to total up the heads and tails and then display them. Could someone help?

Thanks