当前位置:网站首页>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;
}
边栏推荐
- Exercise 9-1 time conversion
- Qt学习20 Qt 中的标准对话框(中)
- JS download files through URL links
- js . Find the first palindrome string in the array
- Redis:字符串类型数据的操作命令
- Similarities and differences of sessionstorage, localstorage and cookies
- Metal organic framework MOFs loaded with non steroidal anti-inflammatory drugs | zif-8 wrapped Prussian blue loaded quercetin (preparation method)
- FPGA test method takes mentor tool as an example
- concat和concat_ws()区别及group_concat()和repeat()函数的使用
- Scroll detection of the navigation bar enables the navigation bar to slide and fix with no content
猜你喜欢
Solution to failure or slow downloading of electron when electron uses electron builder to package
消息订阅与发布
可编程逻辑器件软件测试
Go language web development series 25: Gin framework: using MD5 to verify the signature for the interface station
GoLand 2021.1.1: configure the multi line display of the tab of the open file
玖逸云黑免费无加密版本源码
Message subscription and publishing
Qt学习25 布局管理器(四)
Redis: commandes d'action pour les données de type chaîne
Scroll detection of the navigation bar enables the navigation bar to slide and fix with no content
随机推荐
28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;
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
“又土又穷”的草根高校,凭什么被称为“东北小清华”?
JVM runtime data area
Qt学习25 布局管理器(四)
JVM垃圾回收机
玖逸云黑免费无加密版本源码
Formation of mil-100 (FE) coated small molecule aspirin [email protected] (FE) | glycyrrhetinic acid modified metal organ
Global event bus
Conversion function and explicit
Why don't I have a rookie medal
Qt学习18 登录对话框实例分析
[acnoi2022] guess numbers
Metal organic framework MOFs loaded with non steroidal anti-inflammatory drugs | zif-8 wrapped Prussian blue loaded quercetin (preparation method)
[Jilin University] information sharing of postgraduate entrance examination and re examination
小项目(servelt+jsp+mysql+EL+JSTL)完成一个登录功能的Servlet,具有增删改查的操作。实现登录身份验证,防止非法登录,防止多点登录,记住用户名密码功能。
RocksDB LRUCache
Go 1.16.4: purpose of go mod tidy
Metal organic framework (MOFs) antitumor drug carrier | pcn-223 loaded with metronidazole | uio-66 loaded with ciprofloxacin hydrochloride(
Go language web development series 26: Gin framework: demonstrates the execution sequence of code when there are multiple middleware