Question.Write a program that simulates coin tossing.For each toss of the coin the program should print heads or tails.Let the program toss the coin 100 times, and count the number of time each side of the coin appears.Print the result.The program should call a seperate function cointoss that takes no argument and returns 0 for tails and return 1 for head.



Well my code it aint workin' it keeps on printing heads or talles hundredc time.that when it is executed each time.

Code:
#include <stdlib.h>
#include <stdio.h>
#include <time.h>



int cointoss ( void ); //fucntion prototype

int main()
{
 int sum, cnt;
      srand (time(0));
      sum = cointoss ();


 for ( cnt =1; cnt <= 100; cnt ++){
     if ( sum == 0 )
     printf ("Heads\t");
     else
         if ( sum == 1 )
	 printf ("Tails\t");      }


      getch();
      return 0;
}

int cointoss ( void )

{
    int toss;
    toss = 1+rand() % 2;

    if ( toss == 1 )
    return (0);
    else
        if ( toss == 2 )
        return (1);

}