0 like 0 dislike
1.1k views

Please fix the given code below:

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
	
	$1 sticks = 9;
	int taken;
	int Player = 1;
	
	$2(sticks > 0){
		printf("Player %d -- Sticks remaining: %d",Player, sticks);
		printf("\nHow many sticks do you want to take (1-3): ");
		scanf("$3",&taken);
		
		while(taken>3$4taken<1){
			printf("\nHow many sticks do you want to take (1-3): ");
			scanf("%d",&taken);
		}
		sticks -= taken;
		
		Player++;
		
		if(Player==3){
			Player = 1;
		}
		
	}
	
	
	printf("****THE WINNER IS: Player %d !!****", $5);

	return 0;
}

 

 

[Exercise] Fill in the blank - asked in Chapter 3: Branching, Looping and Functions by (5.9k points)
ID: 34344 - Available when: Unlimited - Due to: Unlimited
| 1.1k views

17 Answers

0 like 0 dislike
Hidden content!
*
***


*
100/100 answered
edited by
0 like 0 dislike
Hidden content!
*
**

**
* **
100/100 answered by (283 points)
edited by
0 like 0 dislike
Hidden content!

*** *

%d
******
***
60/100 answered by (269 points)
0 like 0 dislike
Hidden content!

**

%d
***** * *
*
100/100 answered by (271 points)
0 like 0 dislike
Hidden content!



%d
*** * *
* ****
80/100 answered by (290 points)
reshown by
0 like 0 dislike
Hidden content!
*
*
*
*
**
100/100 answered by (252 points)
0 like 0 dislike
Hidden content!
**

**

** *
100/100 answered by (268 points)
edited by
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.7.9
©2016-2024

Related questions

0 like 0 dislike
18 answers
[Exercise] Multichoice - asked Dec 2, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 35364 - Available when: Unlimited - Due to: Unlimited
| 1.2k views
0 like 0 dislike
14 answers
[Exercise] Essay (Open question) - asked Nov 2, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 30244 - Available when: Unlimited - Due to: Unlimited
| 982 views
1 like 0 dislike
23 answers
[Exercise] Coding (C) - asked Oct 22, 2017 in Chapter 3: Branching, Looping and Functions by semicolon (5.2k points)
ID: 28184 - Available when: Unlimited - Due to: Unlimited
| 3.1k views
12,783 questions
183,443 answers
172,219 comments
4,824 users