2 like 0 dislike
7.1k views

Write a program that input four-digit number, then prints the number with its digits reversed .

寫一個輸入4位數字,反轉輸出這個數字的值

Example input: 

5455

Example output:

5545

Example input: 

5400

Example output:

45
[Exercise] Coding (C) - asked in Chapter 4: Expressions by (12.1k points)
ID: 27669 - Available when: Unlimited - Due to: Unlimited

edited by | 7.1k views

64 Answers

0 like 0 dislike
Hidden content!
* * * * * * ** *
int main()
{int * *
* * ** * * ***** * * * * * *

**
** * * ** * * * ***
}
else ** ** ** * c!=0){
** ** * ** *** * ***
}
else * *** * **** b!=0){
* * *** * ***** ** ** ***
}
else * ** * * ** a!=0){
* * * *** * * **** * **
}
else {
*** ** * *** ****
}
}
answered by (-329 points)
0 0
prog.c: In function 'main':
prog.c:16:17: error: format '%d' expects a matching 'int' argument [-Werror=format=]
 printf("%1d%1d%1d",b,a);
                 ^
prog.c:19:11: error: format '%d' expects a matching 'int' argument [-Werror=format=]
 printf("%1d,a");
           ^
cc1: all warnings being treated as errors
0 0
prog.c: In function 'main':
prog.c:16:17: warning: format '%d' expects a matching 'int' argument [-Wformat=]
 printf("%1d%1d%1d",b,a);
                 ^
prog.c:19:11: warning: format '%d' expects a matching 'int' argument [-Wformat=]
 printf("%1d,a");
           ^
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main()
{
* ***** * * * *** * * * ** * a,b,c,d;
*** * * *** * * ***** * ****** * * **** **** ****** * * ** ** * * ** * *
* *** * ** * * ** * **
    {
    
** * * ** * * ****** * * ***** * * ** * ** * * ** * ** **
* * * * ** * *** * * *
* *** * **** * * * ** ** if (d==0 && c!=0)
** * * *** * *
** * * ** ***** * * *** ** ** * **** * *
** * * ******** * * **** **
***** *** ** * * ** if(c==0 && b!=0)
** *** ***** * *** * ***
* ** * * * * * ** ****** *** * * ** * *
* * ** * *** ** *
* ** * ** ** **** ** * *
* **** * *** * * * *** *
** ***** * * *** **** ** ** *
** * *** * * * * **** *
*** * * *** * *** * * ** 0;
}
[] Coding - answered by (54 points)
ID: 27911 - Available when: Unlimited - Due to: Unlimited

edited by
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()

{
** * * * * * *** * ********* a,b=0;
* **** * * *** ** **** ****** ** * ******
*** * ** * ** *** * *** ***
* ** * ** * ** ** * *** **
* ** ***** ** * * * * * * * *** * ******* ***** ***
* * *** * *** * * * * * *** *** ** *** * * *

    }
* ** * *** * * * * * *** * * * * *

}
answered by (-214 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()

{
** * **** *** ****** * ** ** a,b=0;
* ** * ** * * * * * ** ** ** * * * **
****** * * * ** ** *** * * ***
* ** * * *** *** *
* ** * ****** * ** * * ** * *** * *** * * * ** * * ***
*** * ** **** ** * * * **** * ** ***** * **

    }
* * **** * ** ** ** * * * * * ** *

}
answered by (-214 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>



int main()

{
* ********* * * **** ** * a,b,c,d,e;
*** * * * * *** * ** *** ******** ********* *
* * * ** ****
* ******* *** ** * * * * * *
* **** * * * * * ****
*** * * * ** *** * ***** ***
* * *** * * * *** * * ***** * **** *** * ***


*** ** * ** * * ** * * ** 0;

}
answered by (-498 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main()

{
* *** * * * * * ** n,x=0,y;
* **** ***** * ** ** *** ** * * * * * * *


* * * ******* * * * * * * * 0)
* * * * * * * ** *
**** ** * * ** * * *** ***** ** *** ** * * * *
* * * * ** * * ** **** ** * * ****** * ** * *
** *** *** *** ** **** * * * ********* ** ** * *

    }


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


* ** ** * * * * *** ** *** 0;

}
answered by (-498 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main()

{
** **** *** * **** ** * n,x=0,y;
* * ** * * ** * ***** ** * * * **** * ** ***


* **** *** * ** ** * ** * * * 0)
* * * ***** * ** ** *
* ** * * ** * **** ** *** *** * * ***
*** **** *** *** * *** **** * ** * *** **
** * * * * * * * ** * ** *** ** **** ***

    }


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


**** * * ** * * * * 0;

}
answered by (-498 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main()
{
* * ** * * * ** n,x=0,y;
* *** * ***** * * **** ** * *** * * * *

** * ** *** *** ** * * * 0)
*** **** * ***** *
** ******** ** * * * *** * * * **** * *
*** * * *** ****** * * * ****** * ** * ** *
***** ** * * * * *** **** * ** * ** ** *** *
    }

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

** * ** * ** ***** * * * **** 0;
}
answered by (-498 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
0 like 0 dislike
Hidden content!
#include ** *** **


int main (void)

{

****** * *** *** **** a,b,c,d,e,f,g,h;

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

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



* * * * * * * (e ==0&& f!= 0){

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

* **** *** * * *

** ** * **** *** * * * if (e == 0 && f== 0 *** * *

* * ** ** * * **** * * * *
* **** *** ****
***** ** **** if (e == 0 && f== 0&& g==0){

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

* * * ** *
**** ** * * ** if (e!=0){
** * *** * **** * * * * * ** * ** *
* **** * * *
** * * * * * ****** 0;

}
answered by (-107 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main(void)

{
* * * * * * * **** * a,b,c,d;
** ** ***** *** *** **** x,y,z,t;
** * * ** ** * * *** * * ** *** ** * ** *** ** * * * * ***
** ** *** * ** ** ***
*** * * ** * *** * *
****** * * *****
** *** ** * * **** * *

* * ** **** * * * * (t!=0 && z!=0 )
* * *** ***** * *** **
********* * ** * *** *** ******* **** *** * * * *** *** z, y,x);
* ****** *** * * *** **
** * **** * ** ***** ** if (t==0 && z!=0 && y!=0 && x!=0 )
*** * * *** * * ** * *** *
** * * * * ***** * * * * ** ******* * **** * ** * * ** * ** ** * ** *** ** y,x);}
else if (t==0 && z==0 && y==0 && x!=0 )
* ** ********** * * * *** * * ** **
* * *** ** * * *** * * **** * **** * *** * *** * *** * * * ** * * ********* * ****
* ** ** * ** * **** *
*** * * * * * * ** * * *** **
* * ****** * * ** * ** ** * *** ** * * * * ** * ****** *** * **** * y,x);}
* **** **** * ** * *** ** 0;
}
answered by (-304 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Case 5: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.71.255.21
©2016-2024

Related questions

1 like 1 dislike
85 answers
[Exercise] Coding (C) - asked Oct 26, 2017 in Chapter 6: Loops by semicolon (5.2k points)
ID: 28914 - Available when: 2017-10-26 18:00 - Due to: Unlimited
| 6.5k views
12,783 questions
183,443 answers
172,219 comments
4,824 users