0 喜歡 0 不喜歡
850 瀏覽

Please write a program that receives an input number, then decreases the input by 1 until it reaches '0'. But instead of showing '0', it will output 'zero'.

Example(template)

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

int main(int argc, char *argv[]) {
	int a;                             //can be changed

	printf("Enter your input:");       // DO NOT change
	scanf("%d",&a);

    // Your conditions start from here

	return 0;
}

 

Input

Enter your input:10

Output

Enter your input:10
10987654321zero

 

** No need to put a space between numbers

[練習] Coding (C) - 最新提問 分類:Chapter 3: Branching, Looping and Functions | 用戶: (5.9k 分)
ID: 30222 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 850 瀏覽

20 個回答

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

int main(int argc, char *argv[]) {
* **** * *** int a; ** * *** ** ** ** ** ** *** ** *** ** * *** ** * * * ***** ** * * ** ***** * * * **** *** * * ** ** * * * ** *** *** * ** * * ** * * ** ** ** * ** * * be changed

* ** ** * ** *** ***** * * your * * * ** *** *** ** * ***** ** ****** * * * DO NOT change
* *** ** *** *** ** * * **

** ** ** ** * * ** ** Your * start from here
* *** * * ** *** ** *** * ** * i;
**** * *** * * ** **** ** * = a; i >= 0; i--){
** **   * * * * * * *** if(i == 0){
* * * * * ** * ** ** **** ** * * *
* ***** **** * * else
* * * ** * ** * * * * ** * ** * ** *
***** * * *** * **** }
* * * *
* *******



** *** * * ** return 0;
}
100/100 最新回答 用戶: (221 分)
0 0
Case 0: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include ** * ** *** ****
#include ** ** * ** ** *

int main() {
* * * *** * int a;

*** * **** * * ** * *** your * * * **
* * * * * * ** * * ** *** *** * * * **
******** * * **
* * * ** for(int * * *** ***
**** ** * *** * ***** ** ** * ** if(i==0){
* ** ** * *** * *** **** * * * **** **** * ** *
**** ** * * * ** * **** }else{
*** * * *** *   * * * ** *** * * * ** * * ** *
** * * * ** * * *** *** * }
*** * ** }

* * *   return 0;
}
100/100 最新回答 用戶: (244 分)
0 0
Case 0: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include *** * * * ** *
#include * ** **

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

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

* * * *** * *** * * * * ** * your ** *** ** * * *
** *** * ** * ** * = getchar();
** *** ** ** **** = ** *
* *** * * **** * * ** = getchar();
***** * * ***** = getchar();
* ** * ************* * **** * = * * *
** * ** *** * * * = **
* ** ** ** * ** * **** ** = getchar();


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

* *** ************** q >= 'a' ***** ** * q <= 'z' )
*** ** ** *** ** ** * * ** * * ** * **** ** **** ** q + * ***** * - 'a'));
* ***** *** ** *** * * * * *** ** * * * w >= 'a' * * w <= 'z' )
* * ** * * **** ** * ** ** ** * * *** ** ** ** *** * ** * w + *** * - 'a'));
* ** * ** *** ***** ** *** * ***** * *** * ** e >= 'a' * * ** * ** e <= 'z' )
* ***** * ** * ** * * *** ** * *** * *** ** ** ** e + * * *** - 'a'));
*** * **** ****** * *** * * ** * **** ** * r >= 'A' ******** * r <= 'Z' )
* * ** ** * * * **** ** **** *** * ** * *** ** *** r - ** ***** - 'a'));
* * * ** * *** * * * ** * **** ** * * **** * t >= 'A' ****** ** t <= 'Z' )
* * *** * ** * ** * ** * * * * * ***** ** * ** * * * ** t - ** *** - 'a'));
**** ** *** * ** * * * * * ** y >= 'A' **** * * y <= 'Z' )
** ** * *** **** **** *** * **** * * ** * ** * ** ****** y - ** * * - 'a'));
** * * * * * **** *** * ** ** ** ** * * * u >= 'A' * * ** u <= 'Z' )
* * ** * ** **** **** ** ** * ** * *** ** * * ** *** *** *** u - * **** - 'a'));
* *** *** *** ** * * * * * * * **
** ** ** ** * **

* * ** * * * *
**** ** ** * *** ** *** * 0;
}
0/100 最新回答
重新顯示 用戶:
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
* ** * *** **
* ** * ** *
int main(int argc, char *argv[])
{
* * *** ** *** * * * i, a;
* * * * *** * * * * * ** * **** your input:");
* * * **** * * ** **** ** * ** * &i);
** * ** **** * ** a<i; i--)
*** ** * ** ***** ** * ****** ** ** **** * * * * ** * ** * * **** * * i);
** ** * **** * *** * (i=1)
** ** ** * * * * * ***** *** * ** ***** * *** ** * ****
**** *** * * * ** *** * 0;
}
100/100 最新回答 用戶: (220 分)
0 0
Case 0: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <stdlib.h>
int main(){
int i;
    printf("Enter your input:");
    **** ** ** ** ** * **
***** *** ** ***** * ** ** ** **** ** ** *** * * *** **
* * ** * ** **** ** * ** * *** * * **** ** ** * * * * **** * *
***** * ** ** ** *** * ****** * ***** * * * ***** * ******* ** * * **
* **** ******* ** ****** * ** * * ** *** ** * * **** * * * ** *
* *** * * * * **** ** ** ******* ***** * ** * * *** ** *** * * ****
*** * * ** ** * ** *** ** * ** * ** ** *** * ** * ** * * *** ****** * *** * * ******** *** * * * *
*** ** ** * * * ** *** *** * *** *** * * ** ***** * * * * * ****
* * ** * *** * * *** **** * ** **** * ** *
    return 0;
}
100/100 最新回答 用戶: (243 分)
0 0
prog.c: In function 'main':
prog.c:6:14: error: 'number' undeclared (first use in this function)
  scanf("%d",&number);fflush(stdin);
              ^~~~~~
prog.c:6:14: note: each undeclared identifier is reported only once for each function it appears in
0 0
prog.c: In function 'main':
prog.c:6:14: error: 'number' undeclared (first use in this function)
  scanf("%d",&number);fflush(stdin);
              ^~~~~~
prog.c:6:14: note: each undeclared identifier is reported only once for each function it appears in
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
    int number;
  int i;
* ** * ** ** **** * your input : ");
*** ****** * ** ** *** * * * *** * * * * ** * ** *** **** ** * * * *
* ***** * * * ******** ***** ** ** **** ***** * * * **
*** * ** *** ** * * * * * *** *** **** *** * *** * * * * *
** ** **** * * * ** * * ** * * *** ** **** ** ** **** ** ***** ** * * * * ** ** ** * *
* ** * * ***** *** *** * * * * * ** ***** *** * ** *** ** *** ** *
*** * ** * * * * *** *** * ** * ** * ** * ** * ***** * ** ******* ***
* *** * ** * * ******* *** **** * * * ** * **** * *** ***** * * ** *** * ** **
* ** * ******* * * ** *** **** *** ** ********** * *** ** ** *
***** * ***** ** * * ** * * *** * * *** ** *** *
* ****** *** ** **

    return 0;
}

Input
10

Output
Enter your input:10
10987654321zero
50/100 最新回答 用戶: (269 分)
修改於 用戶:
0 0
prog.c: In function 'main':
prog.c:22:1: error: expected declaration or statement at end of input
 }
 ^
0 0
prog.c: In function 'main':
prog.c:7:10: warning: missing terminating " character
   printf("Enter your input : );
          ^
prog.c:7:10: error: missing terminating " character
   printf("Enter your input : );
          ^~~~~~~~~~~~~~~~~~~~~~
prog.c:8:30: error: expected ')' before ';' token
          scanf("%d", &number);fflush(stdin);
                              ^
prog.c:8:10: warning: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
          scanf("%d", &number);fflush(stdin);
          ^~~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:364:12: note: expected 'const char * restrict' but argument is of type 'int'
 extern int printf (const char *__restrict __format, ...);
            ^~~~~~
prog.c:20:1: warning: format not a string literal and no format arguments [-Wformat-security]
 }
 ^
prog.c:20:1: error: expected ';' before '}' token
0 0
Case 0: Wrong output
0 0
prog.c:23:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before numeric constant
 10
 ^~
prog.c:27:1: error: invalid suffix "zero" on integer constant
 10987654321zero
 ^~~~~~~~~~~~~~~
0 喜歡 0 不喜歡
內容已隱藏
*** * ******* *
* * **** * * * **
int main(int argc, char *argv[])
{
* ***** ** * ** ** * *** i, a;
*** ** * * *** * * * * *** ** * * ***** your input:");
***** * ***** ** **** *** ** *** ** * &i);
** ****** ***** ** ** a<i; i--)
** * * * *** ***** **** *** * ** * ** ** *** * *** * * * i);
** ** *** * ** * * (i=1)
* ** **** **** ** * * * * ** *** * ** *** * ** * *** * * * * **
***** * * * ** **** ** 0;
}
100/100 最新回答 用戶: (283 分)
修改於 用戶:
0 0
prog.c: In function 'main':
prog.c:8:18: error: 'a' undeclared (first use in this function)
     for( i=0; i>=a; a--)
                  ^
prog.c:8:18: note: each undeclared identifier is reported only once for each function it appears in
0 0
prog.c: In function 'main':
prog.c:8:18: error: 'i' undeclared (first use in this function)
     for( a=0; a>=i; a--)
                  ^
prog.c:8:18: note: each undeclared identifier is reported only once for each function it appears in
0 0
Case 0: Wrong output
0 0
prog.c: In function 'main':
prog.c:8:21: error: 'a' undeclared (first use in this function)
     for(int i=0; i>=a; i--)
                     ^
prog.c:8:21: note: each undeclared identifier is reported only once for each function it appears in
0 0
Case 0: Correct output
0 喜歡 0 不喜歡
內容已隱藏
*** * **********
** *** * * ** * *
int main(int argc, char *argv[])
{
*** **** * * * * * * i, a;
* ******* * * ** ** * ** **** * your input:");
** * ******* * *** ** ** * *** **** &i);
** * * ******* * *** ** * a<i; i--)
* ***** *** *** * * **** ** * * * *** * i);
** * * ** * *** * **** (i=1)
* ** * * * ** ** ** ***** ** ** * * * * * * * *** ***** * ** * *
* *** ** * ** *** * ** 0;
}
100/100 最新回答 用戶: (153 分)
修改於 用戶:
0 0
Case 0: Wrong output
0 0
I recommend you use loop run numbers from 10 to 0, then use 'if' to change 0 into 'zero'
0 0
Case 0: Correct output
0 喜歡 0 不喜歡
內容已隱藏
* ** **** ** *
*** * ** * ** * ***

int * argc, char ** * {

* * ** * int a=10;

* * * do{
** ** ** ** * *** ** * ** ** * ** your ***** *
* ** *** * * ** ** * **** ** ** ** * ***
* *** * * ***** ** ** * ***
* ** a != 10 );
*** * *
** ** * * **** 9 8 7 6 5 4 3 2 **** **
* ** *** **
最新回答 用戶: (153 分)
0 0
prog.c: In function 'main':
prog.c:15:2: error: expected expression at end of input
  return
  ^~~~~~
prog.c:15:2: error: expected declaration or statement at end of input
0 喜歡 0 不喜歡
內容已隱藏
** * ******
** * ** *

int * * * argc, char * * {

**** *** int **

******* **** * do{
* **** * * *** * ** * ** * * * your ** **
* * ** * ** ** *** * * ** ** *** * **
** ** ** ** * *** if( a * 10)
* * * ** *** * * * * ** code is too low! * * * *
* * ** * * * * ** * *** * *
*** ** ** * * *** * ** * if( a ** * * 10)
* ** ** * * * * *** * *** * *** * is too high! ** ****
* * * * * * * a != 10 );
*** ** ** ***
**** * ** *** ** 9 8 7 6 5 4 3 2 * ** * *
**** *** * * * ** 0;
}
最新回答 用戶: (153 分)
0 0
Case 0: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.7.46
©2016-2024

相關問題

0 喜歡 0 不喜歡
24 回答
[練習] Coding (C) - 最新提問 11月 2, 2017 分類:Chapter 3: Branching, Looping and Functions | 用戶: nat236919 (5.9k 分)
ID: 30241 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 921 瀏覽
0 喜歡 0 不喜歡
13 回答
[練習] Coding (C) - 最新提問 10月 27, 2017 分類:Chapter 3: Branching, Looping and Functions | 用戶: nat236919 (5.9k 分)
ID: 29558 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 639 瀏覽
1 喜歡 0 不喜歡
23 回答
[練習] Coding (C) - 最新提問 10月 20, 2017 分類:Chapter 3: Branching, Looping and Functions | 用戶: nat236919 (5.9k 分)
ID: 28130 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1.3k 瀏覽
12,783 問題
183,443 回答
172,219 留言
4,824 用戶