当前位置:网站首页>"Fundamentals of program design" Chapter 10 function and program structure 7-3 recursive realization of reverse order output integer (15 points)
"Fundamentals of program design" Chapter 10 function and program structure 7-3 recursive realization of reverse order output integer (15 points)
2022-07-24 22:17:00 【Cha ran o】
This topic requires reading 1 A positive integer n, Then write recursive functions reverse(int n) Realize the output of the positive integer in reverse order .
Input format :
Enter... On one line 1 A positive integer n.
Output format :
Enter... For each group , Output in one line n In reverse order .
sample input :
12345No blank lines at the end
sample output :
54321No blank lines at the end
#include <stdio.h>
#include <string.h>
int reverse(int n);
int main()
{
int n;
scanf("%d",&n);
int m=reverse(n);
return 0;
}
int reverse(int n){
int m;
if (n==0){
return 0;
}
m=n%10;
n=n/10;
printf("%d",m);
reverse(n);
}边栏推荐
- Homework of the 20th week
- 对萌新小白电脑运行速度变慢解决的方法get!٩( ‘ω‘ )و get!٩( ‘ω‘ )و
- Implement redis sentinel to simulate master failure scenarios
- Boundary extraction of PCL point cloud processing (58)
- Go+ language
- Description of differences between esp32c3 led PWM use and esp32
- 数据库之-元数据 DatabaseMetaData 初学
- C # review the entrustment and event
- Apipost signs up with Chinatelecom! Work together to accelerate the digital transformation of enterprises
- Integrated swagger learning
猜你喜欢
![Cell专刊|AI在蛋白结构、精准医疗、抗体疗法[综述]等的应用与未来预测](/img/2e/7f3cbae33c8a994b38e3bf4f9f13cb.png)
Cell专刊|AI在蛋白结构、精准医疗、抗体疗法[综述]等的应用与未来预测

数据库之-元数据 DatabaseMetaData 初学

Gradle 学习 ----Gradle 进阶说明

Esp32485 air temperature and humidity test

Go+ language

Web3安全 Go+Security

Violent recursion - detailed explanation of Queen n & how to optimize with bit operation

SVM - for linear separability (Part 2)

Gradle learning - gradle advanced instructions

Gee - dataset introduction mcd12q1
随机推荐
day10:声明式事务控制
Use of templates
Clever use of sort (list & lt; T & gt;, comparator & lt;? Super T & gt;) comparator
[postgraduate entrance examination English vocabulary training camp] day 11 - offer, form, maintain, critical
暴力递归——N皇后详解 && 如何用位运算进行优化
Mathematical derivation in [pumpkin Book ml] (task4) neural network
Cell special issue | application and future prediction of AI in protein structure, precision medicine, antibody therapy [review]
Monotonic stack structure exercise -- cumulative sum of minimum values of subarrays
A compatible, smaller and easy-to-use web font API
Leetcode 101. symmetric binary tree
Database - Metadata databasemetadata beginner
RISC0:Towards a Unified Compilation Framework for Zero Knowledge
PCL点云处理之找到直线点集的两个端点(五十七)
ACL 2022 | 基于最优传输的对比学习实现可解释的语义文本相似性
QT学习之VS创建QT项目显示未将对象引用设置到对象的实例
SVM - for linear separability (Part 2)
10 key points and 5 measures for good project management
PCL point cloud processing: creating a two-dimensional grid to organize point cloud data (64)
Using FRP to achieve intranet penetration
ansible-playbook 可用参数