当前位置:网站首页>Exercise 6-6 use a function to output an integer in reverse order
Exercise 6-6 use a function to output an integer in reverse order
2022-07-03 14:09:00 【ᯤ⁹ᴳ⁺ ·】
exercises 6-6 Use the function to output an integer in reverse order (20 branch )
This problem requires the implementation of a simple function for finding the inverse number of integers .
Function interface definition :
int reverse( int number );
The function reverse
The integer passed in by the user must be returned number
In reverse order .
Sample referee test procedure :
#include <stdio.h>
int reverse( int number );
int main()
{
int n;
scanf("%d", &n);
printf("%d\n", reverse(n));
return 0;
}
/* Your code will be embedded here */
sample input :
-12340
sample output :
-4321
int reverse( int number ){
if(number<0){
printf("-");
number=-number;
}
int n=0,r;
do{
n=n*10+number%10*10;
number/=10;
}while(number);
r=n/10;
return r;
}
边栏推荐
- Back to top implementation
- JS input number and standard digit number are compared. The problem of adding 0 to 0
- Exercise 7-6 count capital consonants
- QT learning 19 standard dialog box in QT (top)
- Simulated access
- Use vscode to view hex or UTF-8 codes
- 项目协作的进度如何推进| 社区征文
- How to bold text in AI
- Summary of common error reporting problems and positioning methods of thrift
- Dlopen() implements dynamic loading of third-party libraries
猜你喜欢
Qt学习20 Qt 中的标准对话框(中)
Scroll detection, so that the content in the lower right corner is not displayed at the top of the page, but is displayed as the mouse slides
Fabric. JS document
Metal organic framework (MOFs) antitumor drug carrier | pcn-223 loaded with metronidazole | uio-66 loaded with ciprofloxacin hydrochloride(
Exercise 9-1 time conversion
FPGA test method takes mentor tool as an example
Failure of vector insertion element iterator in STL
Use vscode to view hex or UTF-8 codes
Implementation of Muduo asynchronous logging
Exercise 8-7 string sorting
随机推荐
Comprehensive case of MySQL data addition, deletion, modification and query
[ACNOI2022]猜数
Similarities and differences of sessionstorage, localstorage and cookies
Collection of mobile adaptation related articles
Nucleic acid modified metal organic framework drug carrier | pcn-223 metal organic framework encapsulated ad adamantane | zif-8 encapsulated adriamycin (DOX)
Implementation of Muduo accept connection, disconnection and sending data
Go language web development series 27: Gin framework: using gin swagger to implement interface documents
GoLand 2021.1: rename the go project
Vite project commissioning
page owner特性浅析
项目协作的进度如何推进| 社区征文
1px problem of mobile terminal
JVM runtime data area
C language standard IO function sorting
[combinatorics] permutation and combination (two counting principles, examples of set permutation | examples of set permutation and circle permutation)
Selenium browser (1)
Why don't I have a rookie medal
jvm-运行时数据区
Print. JS -- web page file printing
7-9 find a small ball with a balance