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!

**
***
*
*****
80/100 answered by (192 points)
0 like 0 dislike
Hidden content!
**
*

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

* **
**
***
*
80/100 answered by (244 points)
0 0
while -> all small characters :)
0 like 0 dislike
Hidden content!

* *
*
**
*
100/100 answered by (221 points)
0 like 0 dislike
Hidden content!
*
* ***
*
**
*
100/100 answered by (220 points)
0 like 0 dislike
Hidden content!


**
*
* * **
80/100 answered by (183 points)
0 like 0 dislike
Hidden content!

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

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

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

*
*
answered
edited by
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.58.76
©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
| 987 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