当前位置:网站首页>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 :
-4321int 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;
}

边栏推荐
- concat和concat_ws()区别及group_concat()和repeat()函数的使用
- jvm-运行时数据区
- Go language web development series 26: Gin framework: demonstrates the execution sequence of code when there are multiple middleware
- Exercise 6-2 using functions to sum special A-string sequences
- 金属有机骨架MOFs装载非甾体类抗炎药物|ZIF-8包裹普鲁士蓝负载槲皮素(制备方法)
- Common plug-ins for vite project development
- allegro,orcad, net alias,port,off-page connector之间的异同点和如何选取
- How to delete an attribute or method of an object
- [ACNOI2022]猜数
- Uniapp skills - scrolling components -1
猜你喜欢

Installation impression notes

Redis:Redis的数据结构、key的操作命令

How to use lxml to judge whether the website announcement is updated

QT learning 19 standard dialog box in QT (top)

GoLand 2021.2 configure go (go1.17.6)

Qt学习22 布局管理器(一)
[email protected])"/>金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])

Go language web development series 28: solve cross domain access of CORS with gin contrib / CORS

Rasp implementation of PHP

Solve MySQL 1045 access denied for user 'root' @ 'localhost' (using password: yes)
随机推荐
Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
Formation of mil-100 (FE) coated small molecule aspirin [email protected] (FE) | glycyrrhetinic acid modified metal organ
Exercise 7-6 count capital consonants
QT learning 20 standard dialog box in QT (middle)
Vite project commissioning
[ACNOI2022]猜数
Solve MySQL 1045 access denied for user 'root' @ 'localhost' (using password: yes)
Metal organic framework MOFs loaded with non steroidal anti-inflammatory drugs | zif-8 wrapped Prussian blue loaded quercetin (preparation method)
QT learning 22 layout manager (I)
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
交联环糊精金属有机骨架负载甲氨蝶呤缓释微粒|金属-有机多孔材料UiO-66负载黄酮苷类药物|齐岳
Metal organic framework (MOFs) antitumor drug carrier | pcn-223 loaded with metronidazole | uio-66 loaded with ciprofloxacin hydrochloride(
Go language web development series 28: solve cross domain access of CORS with gin contrib / CORS
Too many files with unapproved license
RocksDB LRUCache
Solve the problem of dormitory router campus network sharing login
Analysis of the characteristics of page owner
Uniapp tips - scrolling components
Article content typesetting and code highlighting
Toast UI editor (editor allows you to edit your markup document using text or WYSIWYG, with syntax highlighting, scrolling synchronization, real-time preview and chart functions.)