1 like 0 dislike
3.8k views
Show more...
[Exercise] Coding (C) - asked in Chapter 3: Branching, Looping and Functions by (5.9k points)
ID: 28130 - Available when: Unlimited - Due to: Unlimited

edited by | 3.8k views

23 Answers

0 like 0 dislike
Hidden content!
** *** ** ** *
** * * ** * *

/* run this * ** ** the * *** or add your own * ** * * * ** ** * or *** * loop */

**** *** * * ****** {
* * * *** ** int n;
** * ** *** * * * the what is your ** * * * * * *
**** *
* ** * *** **** * * * **** **
* * * ** *
* ***** * * * *** if( n *
* ** * * * * * * ** ** * * ** ** ** ** ** *
* ** else if( n == 976 )
**** * * ** * ** * *** ** * ** *****
** ** * * ***** else if( n == 66 )
* * *** *** * * * * *** * * * * * * * ** ** * *
* ** * ** if( n == 62 )
** ** * ** * ** ** ** *** * * *
* * * ** * else
*** * *** * ** * ** *** ** * * ** *
* * * **
* ** * * *
** * **** *** 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
It expects 'Input your country code:'

Instead, yours shows: 'Input the what is your country?:'

However, the results are correct, no worries.
0 like 0 dislike
Hidden content!
** * * ** **
* * * * ** * **

/* run this * the * ** or add your own * ** ** ** * * * ** or **** loop */

* ** * * * * * {
* ** * * * int n;
** ** * ** * *** **** the * is ** ** ****** *
** * * *** *
** ***** *** * ** *** * ** * *
*** * * **
* **** * * if( n * *
*** ** ** * **** * ** ** * ** * * * ** * is ** *
* * ** else if( n == 976 )
* ** *** * * ** **** ****** ** is *** * * ** ***
*** ** * else if( n == 66 )
* ** **** **** ** * * * ****** * is * ****
** * * *** * ** if( n == 62 )
* ** * ******* *** * * * * * * * * ** *** **** is * ** ** *
* ** ****** else
* * * * *** * * * ** ** * * **** ** ****
** *** * * *
* * ***
* ** ** **** 0;
}
answered by (153 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!
* * ** *** * * *

int ** argc, char ** * {

int * ***
* * * * * your country * *** ** *
scanf ** *** *** ** * **
if * **** * == 886)

** * ** * * ** * **** **** ** ***

else if *** * == 976)

* * * * *** * * * **** * **** * *
else if * * == 62)
* **** * **
**** * ** * ** *** *** * ** * * * ** ** * **
else if * == 66)

** * ** * * ** ** *** *** * **** * ******** ** ***

else
* ** ** ** * ** ** * * **
* * ** * 0;
}
100/100 answered by (283 points)
edited by
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Correct 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 *** * * **
** * * * * **** *****

/* run this program using the console pauser or add your own getch, * ** ** * * *** or input loop */

int main(int argc, char *** {
* *
* * * * int ***
*** ** ** *
* * ** *** *** * your country * ** *
** * ** ** * *** scanf ** * * *** ** * *** * *

//Your * * starts from here
** * ** *** * ***** * * == 886)
* * ** * ** * * * *** * * * ** ****
** * ** * * ****** **** * * ** * == 976)
* * ***** **** * * *** *** * * *
** ** * *** * ** * ** * ***** == 62)
** ** ** * * * ** ******** * ** * ****
** * ** * * * * ** * ** * * * == 66)
* ******* ** ***** ** ***** *** ** * * *** ** *
** *** * * ***** * *
* *** ** * ** * ***** * * * **** *** * * LOL */
** ** ***** ** ** **
** * ** * * * ** **
* * * **** * ** *** * ****

* * *
** *** *** return 0;
}
100/100 answered by (221 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct 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!
* * ** * * *

int * ** argc, char * ** {

*** ** * int a;
** * *** ** *** *** your *** * **
* ** * scanf * ** * * * **

*** **** if(a == 886)
* * * **** * ** ** * **** *** * ** * **

**** *** * else if (a == 976)
**** * ** *** ** * ** ** * *** ** **** * * *

* ** ** ** * ** else if(a == 62)
* * ** ** * * ** * ** ** * *

** * **** else if(a == 66)
* ** * ** * * * * * * * * ***** ** ** * ** * **

** ** * * * * else
* * ** * ***** * * * * ** * *** **** * * **

*** *** **** * * ******** 0;
}
100/100 answered by (273 points)
1 0
prog.c: In function 'main':
prog.c:10:10: warning: too many arguments for format [-Wformat-extra-args]
   printf("Taiwan", a);
          ^~~~~~~~
prog.c:13:10: warning: too many arguments for format [-Wformat-extra-args]
   printf("Mongolia", a);
          ^~~~~~~~~~
prog.c:16:10: warning: too many arguments for format [-Wformat-extra-args]
   printf("Indonesia", a);
          ^~~~~~~~~~~
prog.c:19:10: warning: too many arguments for format [-Wformat-extra-args]
   printf("Thailand", a);
          ^~~~~~~~~~
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
1 like 0 dislike
Hidden content!
** * * *
* * *** * * * * ** *

/* run this program using the console pauser or add your own getch, ** ** ** or input loop */

int **** * argc, char ** * {
*** * **
*** ** * int ** ***
** * *** ** ** ** *
** * *** * ** ** your ** ** * * * *
*** *** * * ******
**** *** * scanf *** ** * **** *** * *

//Your * * starts from here

** ** ******* * *** ** ** * == 886){
* ***** ** * **** **** ** * * * * ** **** ***
* * * *** *** *** ** ***
* * **** else * * * == 976){
** * * * * ***** ** * * ** *** * * *** **
* * * ****** * }
**** * *** else * * * == 62){
** * *** *** ** * * ** *** *** *** * ***
* * ** * ** * }
* *** *** * * else * **** * == 66){
* *** ** * *** * ** * * * ** * *** ***** **** ** ** *
*** *** }
** * ****** * else{
** ** ** ********** *****
* * * * }
*** *****
* * *
* ***** ** * ** *** * * ** * *
* ** 0;
}
100/100 answered by (281 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
1 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
* * * * ** * * *** * a;
* * ******** ** * *
** *** *** * * *** ******* * * *** a country code:");
* ** * **** * *** **
* ** ** * * * * ** * * * *** * &a);
    
* ** * ** * * * ** * * **** == 886)
** *** * * ******** * * ** * * *** * **** ***** ** *** * * * **
* *** * * * * if(a == 976)
** * ** * * **** *** * * * * ** * * ** * * * *** * * *
* * ** * ** * * *** * * *** if(a == 62)
* * * **** ******* * **** * * ** * * * *************** * * * *** * * *
* ** * * *** * ** * ** * if(a == 66)
* *** * ******* **** **** ** ** * * ** * * * * * * * ** **** * **
** ** ** ** * *** ** *
*** * *** * * ****** * *** ** * ** * ** ** * ** ***
* * ** * * * *******
* ** * * *** ** * * *** *** 0;
}
100/100 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 *** ** * **

int * * argc, char *argv[]) {
* * **
int n;
** * * ** *** the country codes: * **** *** * * *
** * **** **** **

** *
* *** ** * *** * * ** ** **** *** ** *
* * ** else *** ** *
* * *** * * * *** * ** ** * *** * * *
* * * * * else ** *
*** * * *** * * * * * ** ** ** **** **** **
* ** * *** else ** *
** *** * ***** *** ** * * *** * ***** ** ** ***** *
* *** * * * ** *
* * ** ***** *
** ** * ** * * *** ** * **
* * **
***** * ** * return 0;
}

** **
//886
* **
**

*** *
//976
******
**

**
//62
*
* ***

* ***
//66
*
* * *
100/100 answered by (271 points)
edited by
0 0
prog.c: In function 'main':
prog.c:18:1: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
 else
 ^~~~
prog.c:21:2: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else'
  return 0;
  ^~~~~~
prog.c: At top level:
prog.c:25:1: error: expected identifier or '(' before numeric constant
 886
 ^~~
cc1: all warnings being treated as errors
0 0
You need to put double slash (//) for each line of comment
or /* ..... */ for many lines of comment
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
* * ****** * * **

*** * ** **** * * {

n;
* ** the ** ** * * *** ** **
*** * * * * ** **** **


** n == 886 )
**** ** * * **** ** * * *
*** ***** * * if( n == 976 )
* *** * * * *** ** * * *** * * * * ** * **
* * * ***** *** * * if( n == 62 )
*** * ** * ** *** ** * ** * * ****** * * * *
* ** * * **** * * if( n == 66 )
*** **** *** * ** * * ** * * * *** * *

*
* * *** *** ** * *

* * ** **** ** * * ** 0;
}

*
886


**


*

* **
* **

***
62

*
* *

**
66

* ***
** * *

**
* **

*** *
No
100/100 answered by (290 points)
reshown by
0 0
prog.c:26:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before numeric constant
 886
 ^~~
1 like 0 dislike
Hidden content!
* * * * **
** *** * ** *

int * ** argc, char *argv[]) {
* ** * **** int a;
* * * ** ***
* * *** * * a country *****
*** ** *
* * ** ** ** * * ** *
** * *** *
** ** *** ** if(a == 886)
* * * * * ** **** ****** **** *******
* * * ** *** else if(a == 976)
** * * ** * * *** * ** * * *** ** ** ******
**** * ** ** * else if(a == 62)
* * * ** * * * * ** ** ****** ** **** *
** * * * * * else if(a == 66)
* * * *** * ** * * ** * ** * *** * * ** *
* * * **** else
** ** * * ** * * * * ** * * ** *** *
*** * ** **
* ***** ** * * return 0;
}
100/100 answered by (269 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
Nice one. By the way, Fiona, you don't have to put this in your code
    printf("Enter a country code:");

Since the question doesn't require it :)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.178.73
©2016-2025

Related questions

0 like 0 dislike
24 answers
[Exercise] Coding (C) - asked Nov 2, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 30241 - Available when: Unlimited - Due to: Unlimited
| 3.2k views
0 like 0 dislike
17 answers
[Exercise] Coding (C) - asked Oct 27, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 29618 - Available when: Unlimited - Due to: Unlimited
| 2.8k 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
| 1.4k views
0 like 0 dislike
20 answers
[Exercise] Coding (C) - asked Nov 2, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 30222 - Available when: Unlimited - Due to: Unlimited
| 3k views
12,783 questions
183,442 answers
172,219 comments
4,824 users