I need to write this program in C Each turn a player repeate
I need to write this program in C.
Each turn, a player repeatedly rolls a die until either a 1 is rolled or the player decides to \"hold\":
If the player rolls a 1, they score nothing and it becomes the next player\'s turn.
 If the player rolls any other number, it is added to their turn total and the player\'s turn continues.
 If a player chooses to \"hold\", their turn total is added to their score, and it becomes the next player\'s turn.
 The first player to score 100 or more points wins.
For example, the first player, Ann, begins a turn with a roll of 5. Ann could hold and score 5 points, but chooses to roll again. Ann rolls a 2, and could hold with a turn total of 7 points, but chooses to roll again. Ann rolls a 1, and must end her turn without scoring. The next player, Bob, rolls the sequence 4-5-3-5-5, after which he chooses to hold, and adds his turn total of 22 points to his score.
Create this game incorporate the previous project into the
Solution
#include <stdio.h>
 #include <stdlib.h>
int rollDice();
 int main ()
 {
    int num,i,player1_tot_score=0,player1_temp_score=0,player2_tot_score=0,player2_temp_score=0;
     int player;
 int seedVal=0;
    //t is a \'time_t\' type variable
    time_t t;
 seedVal = (unsigned) time (&t);
 srand(seedVal);
 char ch;
   
    player=whoseFirst();
    printf(\"** Player#%d starts the game **\ \ \",player);
   
    while(1)
    {
       
        if(player==1)
        {
            player1_temp_score=player1_tot_score;
            while(1)
            {
                printf(\"\ :: Player#1 Turn ::\ \");
                num=rollDice();
                printf(\"player#1 Rolled %d\ \",num);
                if(num==1)
                {
                    printf(\"Player#1 Total Score %d\ \",player1_tot_score);
                    player=2;
                    player1_temp_score=0;
                   
                    break;
                }
                else
                {
               
                    player1_temp_score+=num;
                    printf(\"If you hold you score will be %d\ \",player1_temp_score);
                    printf(\"\ Do you Want to Hold(Y/N):\");
                    scanf(\" %c\",&ch);
                   if(ch==\'y\'||ch==\'Y\')
                    {  
                    if(player1_temp_score>=100)
                    {
                        printf(\"Player#1 Total Score %d\ \",player1_tot_score);
                        printf(\"Player#1 Wins !\");
                        printf(\"Game Over\");
                        exit(0);
                    }  
                    player1_tot_score=player1_temp_score;
                    printf(\"Player#1 Total Score %d\ \",player1_tot_score);
                    player=2;
                    break;
                    }
                    else
                    {
                    continue;
                    }
                }
           }
           
           
        }
        else if(player=2)
        {
            player2_temp_score=player2_tot_score;
            printf(\"\ :: Player#2 Turn ::\ \");
        while(1)
            {
               
                num=rollDice();
                printf(\"player#2 Rolled %d\ \",num);
                if(num==1)
                {
                    printf(\"Player#2 Total Score %d\ \",player2_tot_score);
                    player=1;
                    player2_temp_score=0;
                    break;
                }
                else
                {
                    player2_temp_score+=num;
                    printf(\"If you hold you score will be %d\ \",player2_temp_score);
                    printf(\"\ Do you Want to Hold(Y/N):\");
                    scanf(\" %c\",&ch);
                   if(ch==\'y\'||ch==\'Y\')
                    {
                    if(player2_temp_score>=100)
                    {
                        printf(\"Player#2 Total Score %d\ \",player2_tot_score);
                        printf(\"Player#2 Wins !\ \");
                        printf(\"Game Over\");
                        exit(0);
                    }
                    player2_tot_score=player2_temp_score;  
                    printf(\"Player#2 Total Score %d\ \",player2_tot_score);
                    player=1;
                    break;
                    }else
                    {
                    continue;
                    }
                }
           }
               
        }
    }
   
   
 return 0;
 }
 int rollDice()
 {
    return rand()%6+1;
 }
 int whoseFirst()
 {
    return rand()%2+1;
 }
___________________________________
output:



