当前位置:网站首页>习题6-6 使用函数输出一个整数的逆序数 (20 分)
习题6-6 使用函数输出一个整数的逆序数 (20 分)
2022-06-11 22:18:00 【小言同学Y】
本题要求实现一个求整数的逆序数的简单函数。
函数接口定义:
int reverse( int number );
其中函数reverse须返回用户传入的整型number的逆序数。
裁判测试程序样例:
#include <stdio.h>
int reverse( int number );
int main()
{
int n;scanf("%d", &n);
printf("%d\n", reverse(n));return 0;
}/* 你的代码将被嵌在这里 */
输入样例:
-12340
输出样例:
-4321
int reverse(int number){
int sum=0,temp;
while(number!=0){
temp=number%10;
sum=sum*10+temp;
number=number/10;
}
return sum;
}
边栏推荐
猜你喜欢

Prefabricated dishes in the trillion market have also begun to roll inside. How can brands stand out in the fierce competition?

Collection of articles and literatures related to R language (continuously updated)

【LeetCode】11. Container with the most water

Uncover the secret of the popular app. Why is it so black

Zhanrui IOT chip 8910dm is certified by Deutsche Telekom

超标量处理器设计 姚永斌 第2章 Cache --2.3 小节摘录
![[Chongqing Guangdong education] college physics of Xiangtan University: mechanical and thermal reference materials](/img/64/683a190d14406a9971edd79037cc97.jpg)
[Chongqing Guangdong education] college physics of Xiangtan University: mechanical and thermal reference materials

Take off efficiently! Can it be developed like this?

How to adjust the font blur of win10

Huawei equipment configuration h-vpn
随机推荐
利用SecureCRTPortable脚本功能完成网络设备的数据读取
[niuke.com] ky41 put apples
【JS】1347- localStorage 的高阶用法
LeetCode栈题目总结
每日一题-1317. 将整数转换为两个无零整数的和
超标量处理器设计 姚永斌 第2章 Cache --2.2 小节摘录
Use the securecrtportable script function to read data from network devices
What is deadlock? (explain the deadlock to everyone and know what it is, why it is used and how to use it)
[Yu Yue education] basic engineering English of Zhejiang industrial and Commercial University (wuyiping) reference materials
leetcode 257. Binary tree paths all paths to a binary tree (simple)
论文阅读《Dense Visual SLAM for RGB-D Cameras》
启牛商学院送华泰账户安不安全?真的吗
图的基本操作(C语言)
Implementation stack and queue
Huawei equipment configuration h-vpn
R language book learning 03 "in simple terms R language data analysis" - Chapter 12 support vector machine Chapter 13 neural network
Xshell不小心按到ctrl+s造成页面锁定的解决办法
Win10弹出USB时出现该设备正在使用的解决方法
Huawei equipment configuration hovpn
Go encoding package