0 like 0 dislike
5.8k views

Question 9: Please a write a program that receives a set of numbers, then outputs the summation of those inputs.

Input1

3
1 2 3

Output 1

6

 

Input2

5
-1 -1 -1 0 0

Output2

-3

 

Input3

2
-1 5

Output3

4

 

[Exam] asked in Final examination by (5.9k points)
ID: 41968 - Available when: Unlimited - Due to: Unlimited
| 5.8k views

21 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(){
***** **** * *** * * *** input=0,n=0;
*** * * * *** ** ** * ** Number=0,Sum=0;
*** **** * *** * * *
*** * *** * ** * ** **** *** *** *** ** * ** *
** * * ** *** *** * **** n<input; n++)
* *** *** * *** *** *** *
* * * * ** * ** * ****** * * * *** ********* ***** * ** ** ** ** ** * * * &Number);
* * * * * ******** * ** ***** *** * * * * * * ** * ********** * ** * **
* * ** ***** * * ** * * **
* * * **** ** *** ** * * * **** ****
** ** * ********* * ** * * * *** ** ** * *
* * *** ** * * * * 0;
}
100/100 answered by (153 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include<stdlib.h>

int main(){
* ** ** * * * * * *** a,b;
* *** * * * *** * * * x[5];
    
* ** * ** * * * * ** * * **** ******* * *
* * ****** * * *
** *** * *** * * * i=0;i<a;i++){
*** * * ** *** **** * **** * ** *** *** * * ** * ** *
*** ** **** * *** * * ** *** * ** *** *
** ** * ** ** * *
***** * ** ** ** *
****** * **** *** * * * * ** ** * * * *
* * * ** ***** *** * * ** * *** ******* **
* * * ***** ****** **** 0;
}
100/100 answered by (254 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include **** *** * ***

int main(int argc, char *argv[])
{
** *** **** * * * *** * * * a,b;
** * * ** ** x[5];
  
** * ** * ** * *** *

** * ** ** *
* * *** ** ** ****** * * i=0;i<=a;i++){
*** * **** * * * * *** *** * * * * *** ***** ** * **** * * * * * *
** * * * *** ** * **** * * * * * **
** * * * ** * * * *
** * * *** * * ** ** *** **** ** *****
*** ** ** ***** ** *** *

** ***** * * ******** * * * *** *** ** ** *
* ***** ** * * ** *** 0;
}
0/100 answered by (273 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
prog.c: In function 'main':
prog.c:16:13: warning: too many arguments for format [-Wformat-extra-args]
      printf("d",b);
             ^~~
0 0
prog.c: In function 'main':
prog.c:16:13: warning: too many arguments for format [-Wformat-extra-args]
      printf("d",b);
             ^~~
0 0
prog.c: In function 'main':
prog.c:16:13: warning: too many arguments for format [-Wformat-extra-args]
      printf("d",b);
             ^~~
0 like 0 dislike
Hidden content!
#include * * ****** * **
*** * * ** *

*** *** ** * * ** readme();
* * * ********** ** ** ** a);

int main(int argc, char *argv[]) {
* ** ** ****
** * ** * int num;
* ** ** ** num = readme();
* *** ** * * **
* ** * ** ** *
* ** **** return 0;
}

int **
** ** **** * * ***** a;
*** ** ** ** * **
* ** *** * ****** * * * * * * * * ** *
* **** *
* ** ** ** * * ** * a;
}

void * ** a){
** * * ** ******** * * ********* * * a);
* ****** *** * ** ***** *** ****

system * * * * * * *
*** ***** * * ****** **** 0;

}
0/100 answered by (290 points)
0 0
prog.c: In function 'printme':
prog.c:29:12: warning: 'return' with a value, in function returning void
     return 0;
            ^
prog.c:24:6: note: declared here
 void printme(int a){
      ^~~~~~~
0 like 0 dislike
Hidden content!
#include *** ** ***** *
#include * * ** *

int main(int argc, char *argv[]) {

** ** *** * int * ** * * = ??; /* number of the sticks remaining in the game */
*** * * * ****** int **** = 0; /* player on turn, either 0 or 1 */

*** ** * * /* game */
*** * *** * * /* Unless this game is over, let player on turn take some sticks... */
* *** * * * ** * ** *** * > 0){
* * *     ** * * /* some game **** * and asking the user */
** ** * * * * * * * * * ** * * * * **** ** **** * * *
**** ** *** ***** * *** ** %d is on turn. %d stick(s) ** * *** * ** * + 1, ** * **
** * ** *** ***** **** /*Lets draw the sticks to the user */
* **** * * * /*like this 5 sticks -> ||||| */
* ** * *     int i;
* ***       for(i = 0 ; i < * i++ )
* ** * ***** ** * * *** ** * **** * * ** **
** * * * * * * * * * * * * ***
* *** ***** ** * * ***** *** * * * * ** * ** ** * * * **
* ** * * * * * * **
* * ** * *** ** *** **** * * == 0){
**** ** * ** ** ** * ***** * * ******** *** ******* * * * ** ** ** ** Player's turn starts here */
** ** ******* * * **** * ** ** * * * ** * * * * **** *** * ** * *** ** * many sticks would you like to take? Input 1 - * *
** ** * *** ** * * * ** * ** ** *
*** ** ****** * * ** **** * ** * ** * * ***** ** /* read the number he wants to take */
* ** ** * *** ** ** * * ** * * * ** * * *** * * ** **** **
* ** * * * ** ** * ** * ** ** * * ****
** ** * * *** * ** *** * * *** * ** * ** **** * *** > 3 || * *** ** * < 1){
* ******* * * * * * * *** ** ** * * * ** ** ** * /* The damn user gave us an invalid * * * * to do * * * */
* * * *** *** * * * * *** ** * ** * ** * ** *** * ** ** ** ** * ** ** *** * are trying to make me angry. That number is not *** * ** **
** **** ** * ** * ** ******* * * ** * * * * * ** * * * * * *** * ********* *
* *** * * * * ** * * * ** *** }
** * *** * *** ** * * * * * * * * ** * /*End of the players turn */
** ** * * ****** ***** * * * * * * *** *
** * * ** **** *** * ******* ** ** * ** * == 1){
* * ** * * ** ** ***** *** ** *** *** *** * {
************ * ** *** * * **** * *** * * * *** **** ** *** * * ** The computer is on turn */
** *** ** * **** * *** * * ** *** ** * * ** * * * *** *** *** ** * 6 or 10 remaining sticks*/
* * ** * * * * * ** * ******* *** * ***** * ** ** **** * **
* * **** * * ** * * * * * *** ** * * * ** * * * * ** *** * * * * * * == 2 || * * == 6 || ** ** == 10 || *** * == 14)
** *** *** * ** * * * * **** * * * * ******** * * * *** * ** ** * ** *** ** *** * ** = 1;
** ** ** * * *** * ** *** ** * * **** * * * *** * ** * * * * *** ******** ***** == 3 || * * *** * == 7 || *** == 11)
*** ***** * * ** * * * * * * * *** * ** * * * * ** ** ** * * ** * * *** ** * ** = 2;
*** * * ****** * * *** * * *** ***** *** * *** * ** *** **** * * == 4 || **** * * == 8 || * * * *** == 12) **** ** ****
* *** * * **** * * * * * **** * ****** * * ** ** * ** * * ** * ** ** * * * ** ** *** = 3;
* ** * * * * * * ***** *** ** * * **** **** *** *** * * * *** ** *** * **** == 1 || * * * * == 5 || ** ***** == 9 || ** * * == 13)
** * * ** * **** *** * *** * ******* * ******* * * ** ******** * ** **** * * ** * *** = 1; //we are going to lose anyways, so just take 1
***** * ** *** ** *** * * ****** ******* ** ** *** * ** ***** * * * * **** *** * * * *
* ** * * * * * * ** ** * * * **** *** * * ** *** * * *
** *** * * ** ** ***** *** * * ** ***** ** * * * * ** * **** * **** * *** ** % 4 == 2)
* * ** * * * ** * * **** ** *** ** * ** ** * * * * * * * ** * *** *** * ** ** * ** = 1;
* ** * ** ** ** * *** * * * * ** ***** * * * ** *** * * ** * *
* *** * * * * *** * **** ***** *** * *** * ***** ** * ** * *** % 4 == 3)
* * * **** * * * * * * * * * * * * * ** * ** ** **** ** * **** * * ****** * * ** = 2;
* * * * **** ***** * ** * * * ** * ***** * **** ** * * * * * *
* ** * * * ** *** **** * * ** * * *** ** * * **** * * **** * ** **** % 4 == 0) ** *
* ****** * * * * * **** * * **** * * * * * * * * *** * ** ** ***** * * * ** **** ** = 3;
* ** * ** * * * * * * **** * **** ** * *********** ** * * ** * * * * **** * *
* * * * * * * * * * ****** ** * * * ** * ** *** * ** **** ** % 4 == 1)
* ** * * ** * *** **** * *** ** ** * * *** ** * * * * * * ***** **** * ** = 1; //we are going to lose anyways, so just take 1
* ** * ** ** **** *** * * * ** * ** ** * * * *** ******** * * ** ** * ** * ** computer decided to take %d *** ** * * * * ***
* * *** *** **** * *** * * * ** * ****** * * *
****** *** * *** *** * *
** * * **** **   /* Apply the turn to the game */
* * * *** * ** **** * * * = ** * * * - *** **** *
** * * * *** ** * * ** -= * * ** * *
* ** ** * * * *
* ***** * **** * ** * * * /* Change the player on turn * *** ** the next turn */
*   ** * *** * ***
* * * ** ** * * * ** * * %= 2; **** * * = **** * % 2;
* * ***** * * ** * *
** * * ** * }
***** * * * *
* * ** * *** /* Let the players know that the game is over and someone won */
*** ** ** ** * * * ** * more sticks **** the game is over. Player %d won! ********** * * * * *** + 1);
* * * **** ** ** * * * * ** ** * *
* *** * * * * return 0;
}

** Please set number(s) given below for ** ***** in which we take 3 sticks every turn,
the computer will be forced to take 1 stick every turn as well. At the end, we will be the winner.
0/100 answered by (243 points)
0 0
prog.c: In function 'main':
prog.c:6:23: error: expected expression before '?' token
  int numberOfSticks = ??; /* number of the sticks remaining in the game */
                       ^
prog.c: At top level:
prog.c:82:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
 Question: Please set number(s) given below for numberOfSticks in which we take 3 sticks every turn,
         ^
0 like 0 dislike
Hidden content!
#include * *** * *
#include * * ****

int main(int argc, char *argv[]) {

** ** * *** int * * *** * = 26; /* number of the sticks remaining in the game */
* ** * * *** int * ** = 0; /* player on turn, either 0 or 1 */

* * * ** /* game */
* * * * * /* Unless this game is over, let player on turn take some sticks... */
** ***   ** ** * > 0){
* * ** * *** * ** * * * * /* some game ***** and asking the user */
***** * * ** ** * * * *** *** **** * * %d is on turn. %d stick(s) * *** ** * * ** * + 1, * * * *
***** ** *** * * * **** /*Lets draw the sticks to the user */
*** * * ** ** ** ** *** * /*like this 5 sticks -> ||||| */
*** *** * ** * * int i;
** * *       for(i = 0 ; i < * ** *** i++ )
* *       * * * * ******* * * * * *
*** * ** ** **** * * ** ** * * * * *** ** *
** ** * *** ** * ** *** ** * *** * ** * ** * *
******** ** ** ** * *
** * * *** * * * *** *** * **** == 0){
* ** * * * ****** *** ***** * * * * ** * * * * * ** * *** ** * ** Player's turn starts here */
** ** **** * * ** ***** * * * *** ***** *** * ** *** * ** ** ** many sticks would you like to take? Input 1 - *
** * * * * * *** **** * * **** * * * ** *
* ** *** ** * ** * *** * ** * ** *** * ***** * /* read the number he wants to take */
** ** ** ** ** **** ** ** * ** ** * * ** *** * **** *** * *
** *** ** * * * * * * *** * * * * *
* ******* * ****** *** ** * * * * * * * *** ** * * ****** > 3 || ** ** < 1){
* ** * ** * * * * *** ** * * * ** *** ** *** **** ** ** * /* The damn user gave us an invalid * * * to do ** * * */
* ** * ** * * ***** **** * * * ** ** * * * *     * *** ** are trying to make me angry. That number is not * * * *
**** * ******* *** ** * **** **** ** *** * * *** ** *** ** *** * ** ** * **** *** *
** * * * * ******** * *** * ** ** * * }
* ** *** * ******* * * ***** ** * ** * ** * /*End of the players turn */
**** * *** *** *** ** *** * * * * * *
* *** **** **** * **** * ** * * * * ** ** * * * *** ** == 1){
* * ** * **** ******* * * * * * **** *** * {
*** ** * * * ** * * *** ** *** ** * * ******* * * *** * ** ** The computer is on turn */
* ** ** ** * * * * * * ** * ** * ** * ** ** ** ** * ** ** ** * 6 or 10 remaining sticks*/
* ****** ** * * ****** * **** * * **** ** ** * * ** * ** *
**** **** ** * * ** ** **** * **** * ** * ** ***** ** ** ***** *** *** * * * == 2 || *** ** * == 6 || * == 10 || ** *** * * == 14)
*** * * * ** * * *** ** ** * * **** * ** *** ** * * * **** ** * ** * **** ** ** * * = 1;
* * ** * * * * * ****** * * ****** *** ** * **** * *** *** * * ** *** * == 3 || * *** == 7 || ** **** == 11)
* * ** ** * ** * * * ** ** * ** ** * * * *** *** ** ********* ** ** ** * ** * ** ** = 2;
** *** * * * ** ** * *** ** ** * *********** ** ** * ** ** * ** * ***** *** * * * == 4 || * *** == 8 || ** * == 12) * * **
* ** *** * * *** * *** ** ** * ** ** * ***** *** * * *** ** ** ** * * *** ******* * = 3;
***** * ** ** * *** * * * ** ** ***** ** * ** *** * ** == 1 || * ** * == 5 || * **** == 9 || ** * *** == 13)
* ***** *** ** ***** * *** **** * ** ** ** ** * *** ***** * * **** * ** * ** *** = 1; //we are going to lose anyways, so just take 1
** * * **** * * * * ** *** *** **** * * * **** * ** * * * * * * *** * *** * * **** **
*** *** *** * * * * * * ***** ** ** * ** **** * * *** **
* ** ** * *** ***** ** * ** ** ** ** ** * ** *** * *** *** **** * ** ** % 4 == 2)
* ** ** ** ** ** * ********** ************ *** * * *** * ** *** ** ***** * * * ** **** = 1;
* *** * * * *** *** * ***** * ******* * *** * ** * * **** * * ** **** % 4 == 3)
*** * ** **** ** * * * * * **** * * * * * ** * **** *** * * * * ******* * * * ** * * = 2;
** *** * ***** ** * ***** ** * ** * *** ** **** * * * * *** ** ** ** ** % 4 == 0) **** * * *
* *** *** ** **** ** * **** ** ** *** **** * * * ** * ** ** ** * * * * ***** *** ** ** = 3;
* * *** *** * * ** * * * * *** * ** * * *** **** ** * * * * ** * ** ** ***** % 4 == 1)
** * * **** ** * *** * *** *** ***** ******* ** * * ** *** * * * * **** * ** ** ** * = 1; //we are going to lose anyways, so just take 1
* ** * * * * * * ** *** ** * * ** *** * * ** * **** ** ** computer decided to take %d * ** * ** ** *** *
* * * * * * ***** * ** * **** * * *** **
*** *   ** **** ** **
*** ** * **** ** ***** ** /* Apply the turn to the game */
* * * * * * **** ** = * *** * ** - ** ** * *
** * * * * * * * *** * -= ** * *** ** **
* *** *** * ***** * * *
*** * * **     /* Change the player on turn * **** the next turn */
** ** ** * * ** * *** ** * ****
* *** * * ** **** *** * * *** %= 2; * ** = * ** % 2;
**** * * ** **** * *** ***
*** ** }
** ** * *
***** * /* Let the players know that the game is over and someone won */
* ** *** ** ** * * * more sticks * the game is over. Player %d won! * * * * * * ** * *** ** + 1);
* **** *** ** * **** *** ***** *** *** * * ***
*** * * * *** return 0;
}
answered by (269 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include * ** * **
#include ** ** * ** *

int main(int argc, char *argv[]) {

** * * int ** * ** * = ??; /* number of the sticks remaining in the game */
* ** * ** * * int **** ** = 0; /* player on turn, either 0 or 1 */

* * * ** * /* game */
* *** ** **** /* Unless this game is over, let player on turn take some sticks... */
** * * ** * * * > 0){
* ** * * *** * *   /* some game * ** * and asking the user */
** ** ** * ** *** *** * * ** ** * * * * * **** * ****** * * *
** * * ***   * * * *** ** %d is on turn. %d stick(s) ** *** * *** * * ** + 1, * ** *
* *** **** * *** * ** * /*Lets draw the sticks to the user */
* * ** *** * * * /*like this 5 sticks -> ||||| */
** * * *** * ** int i;
** ** * *** * * * *** * for(i = 0 ; i < *** * i++ )
** * *           ** * ** **** *****
* * **       *** * * ** ***
** * * ***** *** * ** * * ** *** * ** * * * * *** ******
*** * *   ** * *  
        * * * * == 0){
* * * * ** *** **** * ** * ********** * ***** * **** * * **** ** * Player's turn starts here */
* ** ** * * ** * * ** * * ** ** ** * ******* ** ** ** **** **** ** * * * many sticks would you like to take? Input 1 - * * *
* * * * *** * **** **** ** * * * * *
** * ** ***** * * **** * *** * * ** * ** * ** /* read the number he wants to take */
* * ** *** * ** ** ****** ***** *** * * ** * * ** * * * * *** * * *
* * * * * *** ** * * * * ** ** * ** ** **
*** ******** * *** * * ** * * ****** * * * ** * > 3 || ***** < 1){
** *** * ***** ** * ** **** * *** **** * ** * * *** /* The damn user gave us an invalid * * * to do * *** */
*** **** * *** *** * * * * **** ** ** ** * ***** **** **** * are trying to make me angry. That number is not ** * * *
******** * **** * * * *** * * * * *** ** * * * *** * ** ****** * * ** *** * * * * *
* *** * * * * ** ** * ** ** * }
**** ** ** * *** ** * * * * ** *   /*End of the players turn */
** * *** *** ** * * * *** * * * ********
* ** * *** * ** *********** ** ** * ** * ** * == 1){
* ****** * * *** * ****** * ***** * ** {
* ** ** * ***** **** ** * * ** ** ******** * * * * ** The computer is on turn */
* ***** *** *** ** * * *** ** **** * *** * ***** ***** 6 or 10 remaining sticks*/
** **** **** *** * * ** **** ** * *** * * ** * *** * ***** * ** **
* ** *** *** * * * ** * * * **** * ** ** ** ** * * *** *** == 2 || * * ** == 6 || * *** == 10 || ** ** == 14)
* *** ** * *** ** * *** * * * * ** * * ** * ** ** *** ** * * * **** * ****** * *** *** = 1;
* * *** * * * **** *** * * ** ** * * ** ***** * * * ** *** **** *** == 3 || * *** == 7 || ** == 11)
** ** *** ** * * ******** * *** **** * *** * * **** * * * * * *** *** = 2;
* * ** ** ***** * ** ** *** * * * * *** * * * **** ***** * ****** ** *** == 4 || ** * * * == 8 || * * ** * == 12) * * * *
*** * * ** * * ***** *** **** * ** ** *** ** *** *** ** * * *** *** * * *** ** ********* * *** = 3;
** *** ** * ** * * ** ** **** * * *** ** *** ***** * **** ** *** * **** *** ** == 1 || ** * == 5 || * ** ** == 9 || ** **** == 13)
*** ** * **** * * * * * ** *** * ** ******** ** ** * * ** * **** = 1; //we are going to lose anyways, so just take 1
* *** ** *** ** * ** ** * ******* ** * ** ** ** * * * * ** *** **** ** ** * * **** *** ******
* * * * ** ** * * * * * *** ***** * ** * ***** * *** ** ** **** **
* * *** * * *** *** ** * ** ** ** ** ** ** * * * * **** * ** * * * * * *** *** % 4 == 2)
** ** * *** * *** *** * **** * * ** ** * * * ** * * ** ** * * *** * * * * ** ****** = 1;
* ** *** *** ** * * * ** *** * * ***** * * * * * *** * * * * *** **** * ***
* * * *** *** *** * * * ** ***** * * * * ** * ** ** * * ** * * *** % 4 == 3)
** * ** *** **** *** ** * * *** ** ** * * ***** * * * ** * *** ** * ** *** * *** * **** ** * = 2;
* * *** ** ***** * * ** * ** *** *** * * ** * * * * * *** * * * ** * * * ***
* * * * * * **** *** * ***** * ** * ** * * * ** ** * * * * * ******* % 4 == 0) **** * *
* ****** * ***** ** ** * * *** *** ** * * **** * * * * ** * * ** ***** * * * * * * = 3;
** ** * * ***** *** * * * ** * *** * * * *** ** * ** ** * * ** * * * * * * **
* * * * * ** ** ** * * * **** **** ** ** ** ** ** ** *** ** **** % 4 == 1)
** * * * * ** * ** ***** ** **** *** * ** * * * ** * **** *** *** * ** * * * * *** **** * *** = 1; //we are going to lose anyways, so just take 1
** ** ** *** * ** ** ** ** ****** ** * * ** ** **** ****** * * * * computer decided to take %d ** * ** ** * ** * * * *
* * ** * * *** * * * ** ***** ** *
**** * *** **** *** *
** ** * *   /* Apply the turn to the game */
*******   ** **** *** * *** ** = ****** - * *** * *** *
* ** * * * * * ** * * * **** -= * * * ** *
* *** * * * * * * **
******* * ** **   /* Change the player on turn * * *** the next turn */
** * * ** *** * * ** ** * *
** **** ***** * * ** ** *** ** %= 2; ** *** = ** **** % 2;
*** ** * *  
    }
* * * *** ***
**** ** ** /* Let the players know that the game is over and someone won */
** * **** * *** *** more sticks ** * the game is over. Player %d won! * ** ** * * * * + 1);
****** * ** ****** **** ** * * *** *
** return 0;
}
answered by (269 points)
0 0
prog.c: In function 'main':
prog.c:6:23: error: expected expression before '?' token
  int numberOfSticks = ??; /* number of the sticks remaining in the game */
                       ^
0 like 0 dislike
Hidden content!
#include * *** * **** *
#include * ** ** *

int main(int argc, char *argv[]) {

* * *** int * ** = 26; /* number of the sticks remaining in the game */
** ** * int ** * * = 0; /* player on turn, either 0 or 1 */

** * /* game */
* * * *** * /* Unless this game is over, let player on turn take some sticks... */
*** *   ** * > 0){
* ** * ****** * * ** ** * /* some game ***** * and asking the user */
* * * * ** *** * * * * %d is on turn. %d stick(s) *** ** ** * * + 1, *** ** *
** * * *** * * * * * /*Lets draw the sticks to the user */
* * * * * ** * * /*like this 5 sticks -> ||||| */
* * * ** * ** ** * * int i;
* *       for(i = 0 ; i < * *** ** i++ )
*** ***       * * * * ** * * * *** ** * * *
*** *** ** * * * * * *** * **** *
* ** ** *** ***** * * * ** * * ***** * ** ** ***
* * * * *** * * *****
* ** * ** * * ** *** ** * *** == 0){
** * * ** *** ** * * ** * ** ** * *** * * * ** * ** *** * * * * * Player's turn starts here */
*** * ** * ** * ** ** * * * ******* *** **** * **** * *** * **** * ** **** ** many sticks would you like to take? Input 1 - ** * *
*** *** * *** ** **** **** * * ** * ** *
* * ***** ** **** ******* * * * *** ** * * /* read the number he wants to take */
** ** ** * ** **** *** * *** * ** * * * * * * * * * * * *** * * * ** ** *** ** *
*** ** * ** * ** ****** ** * **** * **
* ** * ** * *** *** *** * * ** * ** ** *** * * **** * *** * * > 3 || ** *** * * * < 1){
**** ** * ******* *** ** * * * *** * * * * /* The damn user gave us an invalid to do **** */
*** ** * * * * *** * ** * * * * * ** * **     **** *** are trying to make me angry. That number is not ** * * * ** *
*** **** * ** ** * *** * * * * *** ** *** *** * *** * * * ** ** * ***
** * *** * * ** ** **** ** * ** * * *** * * * }
**** ** **** * * **** ** * * * **** ***** * ** /*End of the players turn */
* ** * * * ** * ** * **** * * ** * * ** * ****
* ***** * *** *** * ** ** *** ** **** * **** ** * ** ** == 1){
*** ** * ** ** * **** * * ****** ** *** *** * {
*** ** * * ** *********** ** * * * * *** * * ***** * * * ***** The computer is on turn */
* * * ** * * * * **** ** * * * ** ** * ** * *** * * ** * 6 or 10 remaining sticks*/
* * ** **** ** ** * * * **** * * * *** ** * * **** ** * *** * *
* ** * * * *** * *** ** * * ****** ******* ** **** * ***** * ** * * * * == 2 || * *** == 6 || * **** == 10 || * * == 14)
* ***** ** ** ** * * ***** * ***** ** ** * * **** * ** * * * ******* **** ** * ** * * *** = 1;
* * * **** ** * * * * * * *** ** * ** **** **** ** ***** * ** ** *** ** ** == 3 || ** ** == 7 || *** *** == 11)
* * * * **** **** **** * * ** * **** ** ** * * * * *** **** *** ** * * ** ** * * * * * *** = 2;
*** **** * **** *** **** * * **** * * ** ** ****** * * **** * * * **** * == 4 || * ** * * ** == 8 || **** * * == 12) * * * * *
* * * ***** * * * * * * ***** * * ** ** ********** ** * * ** * * ****** * * ***** * = 3;
** ***** *** * * ******** ** * ** ** ** * * * * * **** ** * * * **** ***** == 1 || * * * * == 5 || *** **** == 9 || * * **** == 13)
* ** * ** *** * ** * * *********** ** * *** ** * * * * * ** ** ** * * ** *** * * * ** * = 1; //we are going to lose anyways, so just take 1
**** ** ** * * * * **** *** * ** ** ** * ** * ** *** ** ** *** * * * **** ** * * * *
* * ** * * ** ** * * * * *** ** * **** * ** *
*** *** * ** * **** ** ** ****** *** ******* *** * * * **** ** ** * * ** % 4 == 2)
* ** * ** ********* * * *** *** *** ** ** * ** * ** * * ** * **** * * * ** *** * *** = 1;
* * ***** ***** ** ** * ** ***** ** ** ******** * * * * ** * *** * % 4 == 3)
** ** ********* ** * ** **** *** ** ** * * ** *** ** ** ** * * * *** **** ** ** **** * * *** = 2;
*** * ** * *** * *** * * *** * * ** * *** *** * * * * **** * * % 4 == 0) * * * *
** *** * * * * ***** * * * **** * *** **** *** * ******** ** * * *** ** *** ** * = 3;
** ** * * * ** * * * * * * * *** * * * *** ************ * *** * % 4 == 1)
* * **** * ** *** *** ** ** * * * ** * * ** ** * * * ** * * **** * * ** **** *** * * * * *** = 1; //we are going to lose anyways, so just take 1
*** ** * *** * ** * ** * * * * *** * * **** ** *** * * * *** * ** * **** *** * computer decided to take %d * *** ** ** *** ** ** *** ***
* ** * * **** * * **** * **** ** ** ** **** * *
* **   * * ***
*** *** * * ** ** *** /* Apply the turn to the game */
**** * *** * ** * * **** * * = * * * - *** * * **
** * ****** **** *** * * *** -= * ** **
*** * * * * * * * * * *
* ***     /* Change the player on turn * *** the next turn */
** ** * ** * * * **** * * ***
* ***** **** * *** ** * * %= 2; * * * * = ***** * % 2;
*** *** * * ** * * * *** ***
**** * * ** }
* ** **
* * * **** * /* Let the players know that the game is over and someone won */
* ** * ***** *** ** ** ** more sticks ** *** the game is over. Player %d won! ** * ** ** ** **** * + 1);
* * * ** ** * * *** * * ***** ** * **
**** *** return 0;
}
answered by (269 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
* ** * * ** ** * ** x[] = {56,100,16,13,10,25,48, -52, 1523};
** *** *** ** * ** * * * size = 9;
*** * *** * ** ***
** * ** ** * * *** ** * print the array */
*** **** ****** **** * *** ** * i = 0; i < size; i++){
**** *** * * ** ********* * ***** * * ** ", x[i]); * * ******** ** *** *** *
**** * * * **** *** ***
** * *** ** *** ***** * * *** * *** **
* **** ** ** *** * ***
*** *** ** ** ** ** ** **** I need this to happen size-times */
** * * *** * **** **** ** j = 0; j < size; j++){
* * * * ** * * * ** ** * * *** ** * from left to right */
* ** ** * ** * * ** **** * * *** ** *** ** ** * ** i = 0; i < size-1; i++){
**** ** * ***** *** * * *** * * ***** ***** ** ** * * * * * * ** i-th element with its neighbor to check if they are in order */
** *** * *** * ** * ** ** ** * * ** ***** *** *** * * **** ** > x[i+1]){
** * * * * * ***** *** * * * * * * * * *** * *** * * * **** * * * * * exchange the values of x[i] and x[i+1] */
** * * * *** * **** * * ***** ******* * ** *** ***** ***** *** *** ****** * **** * temporary; * **** *** * * * ** ** ** ***** *
* * ** * * *** ** ***** ** ** **** *** ** * * * * * * * ***** ** * *** *** * * = x[i];
* * * * ** * **** **** * *** * ** * *** * * ** **** ** ** ** *** ** * = x[i+1];
* ** * ** ****** * *** * ** ** * *** ** * * * ** ** ** * *** * *** ** * ****** ** * *** *** = temporary;
* ** * *** ** * **** * * * * **** *** **** ** ** * * * * ** **
** *** * ** ** ** * * * * * * * *** * ** *
* ** ** *** * **
** ** * * * ** ** *
* * ** **** * print the array */
*** * ** ** * ****** ** *** * ** * * ** sorting: \n");
***** * * ** ** ** * ***** i = 0; i < size; i++){
** * ** * *** * * ***** * ** *** *** * *** *** **** ", x[i]); * ****** ** ** * **** ** * ** * **
* * * * *** * * *
** * * * ** * **** **** * * * **** * **** * * *
**** *** * * ** * ** *
    
* * ** * *** *** * *** **** ** **
** ** ** ** * * ** **** ** * * *** * * *** **  
* * ** * ** ****** 0;
}
answered by (269 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
    
    int a,b;
* * ** **** *** * ***** * ** ** **** ***
* * * * ***** ** * * *
* * ***** * * ** * * * ***** **** ** ** * * * * *** ** * * * **** * ** * * ** * * ****** **** * **** **** **
******* ****** * * ** ** * * * * * * *** ** * *** * ** * * ** * ** * * ** * * ** * ** ** * ** * * * ** * ** * * ** *
**** * * *** * ** ** ** ** * ** * * * *** ** * *** ** *** * * * * *** ** **** * ** **** *** ** * ** ****
* ** * * * *** * *** * * ** *** ** ** * ***** *** * ***** **** * ** ** * **** * *** ****** *** *
***** * ** * ** ** * **** ** * * *** * ** * * ** * ** ** *** * ** ** ********* * ** * ** ** *** * * * * *** ***** ** * * * **
* ***** * * * * * ** * * *
   return 0;
}

    
answered by (153 points)
edited by
0 0
prog.c: In function 'main':
prog.c:11:29: error: expected statement before ')' token
                             )
                             ^
prog.c:16:3: error: expected declaration or statement at end of input
   }
   ^
0 0
prog.c: In function 'main':
prog.c:11:29: error: expected statement before ')' token
                             )
                             ^
prog.c:15:3: error: expected declaration or statement at end of input
   }
   ^
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.111.109
©2016-2025

Related questions

0 like 0 dislike
22 answers
[Exam] asked Jan 13, 2018 in Final examination by nat236919 (5.9k points)
ID: 41975 - Available when: Unlimited - Due to: 2018-01-17 16:30
| 6.2k views
0 like 0 dislike
30 answers
[Exam] asked Jan 13, 2018 in Final examination by nat236919 (5.9k points)
ID: 41942 - Available when: Unlimited - Due to: 2018-01-17 16:30
| 6.6k views
0 like 0 dislike
26 answers
[Exam] asked Jan 13, 2018 in Final examination by nat236919 (5.9k points)
ID: 41937 - Available when: Unlimited - Due to: 2018-01-17 16:30
| 3.3k views
0 like 0 dislike
21 answers
[Exam] asked Jan 13, 2018 in Final examination by nat236919 (5.9k points)
ID: 41935 - Available when: Unlimited - Due to: 2018-01-17 16:30
| 2.6k views
0 like 0 dislike
23 answers
[Exam] asked Jan 13, 2018 in Final examination by nat236919 (5.9k points)
ID: 41926 - Available when: Unlimited - Due to: 2018-01-17 16:30
| 3k views
12,783 questions
183,442 answers
172,219 comments
4,824 users