4 喜歡 0 不喜歡
349 瀏覽

Please write a simple program that can detect 4 country codes: 886 = Taiwan, 976 = Mongolia, 62 = Indonesia, and 66 = Thailand by using if... else condition. If the code doesn't match any of those four, the program must show No

Example

#include <stdio.h>

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

int country_code;
printf("Input your country code:\n");
scanf ("%d", &country_code);

//Your condition starts from here

else 
	printf("No");

    return 0;
}

Example Input 1

Input your country code:

886

Example Output 1

Taiwan

 

Example Input 2

Input your country code:

976

Example Output 2

Mongolia

 

Example Input 3

Input your country code:

62

Example Output 3

Indonesia

 

Example Input 4

Input your country code:

66

Example Output 4

Thailand

 

Example Input 5 (else case)

Input your country code:

696969696969

Example Output 5 (else case)

No

 

Explanation

You might be wondering why your result is wrong even you have the same result, that's because an online judge is strict and sensitive; here some cases:

1. Your result MUST be the same as the fixed output, even dot(.), space( ), printf, misspelling, etc. make the result to be wrong.

2. An online judge works the same as a compiler installed in your computer, you don't need to put anything except the code there.

3. For more information and practice, please visit --> http://www.pipls.net/27431/must-read-an-example-program-for-online-judge

[正常] Coding (C) - 最新提問 分類:Questions Bank | 用戶: (5.9k 分)
ID: 30261 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 349 瀏覽

1個回答

0 喜歡 0 不喜歡
內容已隱藏
#include ** *** **** *

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

**** *** * int ** * *
* * * *** ** your country ** *
* * * * * scanf * * * * * * *** * * * ******
* * ** *** **
* ** * //Your condition starts from here
* ** * *** if ** **** *
*** * ** ** **** ** *** ** * ** ***** * * **
* * ** * * * else if ** * ****
* * *** * * *** ** * * * * * ******** ** ** ** * * ***
** * ** else if *** * * *
** * * * * * **** *** * ** ** * * * *** **
* *** * **** else if ** ** ***** * *
*** * *** *   * * *** ********* **** *** * * * *** ** * ** *** *
*** ****** else
*** * * * ** * * * * **** ** * ****
** * ** *
* * * * * ** **** * ***** * * *** * 0;
}
最新回答 用戶: (-304 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.7.36
©2016-2024

相關問題

4 喜歡 0 不喜歡
0 回答
[正常] Coding (C) - 最新提問 11月 3, 2017 分類:Questions Bank | 用戶: nat236919 (5.9k 分)
ID: 30264 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 380 瀏覽
12,783 問題
183,443 回答
172,219 留言
4,824 用戶