0 like 0 dislike
855 views

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

[Exercise] Coding (C) - asked in Chapter 3: Branching, Looping and Functions by (5.9k points)
ID: 30222 - Available when: Unlimited - Due to: Unlimited
| 855 views

20 Answers

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

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;
}
answered by (153 points)
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
*** **** * *** *
** * *** ***** * *

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;
}
answered by (153 points)
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include * * * * * * *
#include *** * * *** **

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

    * * *** ** your * ***
    ** * **** * *** *
* *   ** ** * *** * *
**** ** ** ** ** ***** * * * * * * **
** ********** *** ** * * * ** ** * * *** ** * * * *
** * * ** * ** ** ** ** * * *** * * * * ** * ** * ****** * *
** * * ** ** * ** ** ** *** **** *** **
** * * * * * *** * * ***** * * **** ** * * ** * * * * * ** * * **** ** *
**** * ** ***** * * ******* * * * * * * * ** * *

    return 0;
}
100/100 answered by (183 points)
0 0
prog.c: In function 'main':
prog.c:14:21: warning: too many arguments for format [-Wformat-extra-args]
             {printf("zero",i);}
                     ^~~~~~
0 like 0 dislike
Hidden content!
**** ** *** * * ** *
* * ** * *** *** **

int * argc, char **** {
* * *** ** ** int a;

** * * * * ***** * your * ***
* * * * ***** ** * * **** * *

*** ** **** ** ** ** *** * 0) {
* ** **** * * ** * * * ** ** * * * a);
** * * * * ** ** a = a - 1;
*** ** }
* **** * * * **
** * * if(a == 0){
******* * ** * * ** *** * * ****** a);
*** * * }

* * **** return 0;
}
50/100 answered by (269 points)
0 0
prog.c: In function 'main':
prog.c:16:10: warning: too many arguments for format [-Wformat-extra-args]
   printf("zero", a);
          ^~~~~~
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main(){
**** ***** ** ** ** * ** * a;
** * *** *** ** * ** ** *** *** your input:");
*** * *** ** * ** * **** * ** * &a);
* * * ******** * * ** * * * {
**** * * * * * **** ***** * *** * * ***** *** * *** ******* a);
** * * ** * ** ** *
***** * * * ** *** * ***** ** *** *
}
100/100 answered by (273 points)
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main(){
int number;
int i;
* * * ** * ** * * * * ** ** ***** your input : ");
***** * * * ** * * ** ** ** *** *** *** *** **
** * * *** ** * * * * ** * * *** * * ** ********
* **** ** ** ***** * * ******* *** * ** * * * * * * * ** ** ** **
** * * ** ***** ** * ** * ** ** ** * ** ***** ** ** ** ** ** * * **** * * * * * *** ****
* * ***** * * * * ** * ** * * ***** * * * * * * * * * *** ** ***
* ** *** ** * * * ****** **** * * * * * ******* *** **
********** * * * ********* * * * * ***** *** ** ** * * ** **** * * * ** * ** ** * ** * * *** ***
** ** *** ** * **** ** * ** * *** * **** * ** * * * * * *
** ** * **** **** *** * ** ** * ***
    return 0;
}

//INPUT
//Enter your input: 10

//OUTPUT
//Enter your input: 10
//10987654321zero
100/100 answered by (290 points)
reshown by
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
* ***** ** * * **
int main(){
int number;
int i;
** * * * * ** * * * your input : *
* * * **** *** *** ******** * * *** * * *
* * **** * ***** ** **** ******* **** ** ** * **
*** * * * * * * * * *** ** ** * ** ***
*** * *** * * **** * * * **** * * *** ** ** * ** * * * **
* * ** * *** ** * ** * * **** **** * }
* ** * * * * * * ** * if(i==0){
* * * **** * *** **** **** * **** * *** * * * ** * * ***
* *** *** * *** * * *** ** * ** * }
* ***** * * ** *** * }
* *** ***** * return 0;
}

//INPUT
//Enter your input: 10

* * *
//Enter your input: 10
* * **
100/100 answered by (271 points)
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
* *** * ** ** **
* * ** ** * ** * **

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

int * * argc, char * * {
******* * **** int a = 0; ** *** *** ******** *** * ** * * **** * **** ***** *** * ** ** ** ** * ****** * ** **** * * ***** * * * *** *** ** * * *** * ** ****** * * * ** * * ** * ******
* ***** * *** * ** *** *** * * ** your input: * ** ** *** *** ** * *** * * * *
*** * * * ** ** * * ** ** * ** * * ** ** ***** *
***** * * while (a *** * 0){
* ** ** * * * **** *** * * * * * %d * *** a);
** * * ** * * * * * * * * * a = a - 1;
}
*** * *** * * **** ** * * * ** ** *** *
* *** **** return 0;
}
50/100 answered by (252 points)
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include ** ** * * *
#include ** ********* *

int main(int argc, char *argv[]) {
    int a; * ** * ** ** ** * *** * * ** ** **** *** * ** * ** *** * ** *** * ** * * ** ** * * * * * ***** * * ** * *** *** * * *** ****** ***** *** * *** ** be changed
do
* ** ***** ** * **** *
    printf("Enter your input:"); ** * ** ** *** ** * ** **** * * *** * * DO NOT change
    * * * * * ** *
    }
* ** ** ** *** * * * * ** * * * *

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

* ** ** ******* * ** * * ******* * * **
* ** * ** * * ** ** *** * * *
}
100/100 answered by (268 points)
0 1
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include * ****** **
* * * * * ** * *

int main(int argc, char *argv[]) {
** *** ** ** int a;
** * *** * * * * *** your * * * ***
**** * * * ** * * *** ** ** *** * * ** * *
* ****
** ** **** **** ** ** * *
* * * ** * *** ** *** if(a==0)
** ** ** * * * * * {
***** *** * * **** ** ** * ** **** * * **
** * * ** ** * * * }else
*** ** * ** *** ** * * * **** *** a);
******* * * * * }
** * *** *
***** **** * ** * return 0;
}
answered by (5.9k points)
0 0
Case 0: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.7.131
©2016-2024

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
| 924 views
0 like 0 dislike
13 answers
[Exercise] Coding (C) - asked Oct 27, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 29558 - Available when: Unlimited - Due to: Unlimited
| 648 views
1 like 0 dislike
23 answers
[Exercise] Coding (C) - asked Oct 20, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 28130 - Available when: Unlimited - Due to: Unlimited
| 1.3k views
12,783 questions
183,443 answers
172,219 comments
4,824 users