当前位置:网站首页>【C语言】进制转换一般方法
【C语言】进制转换一般方法
2022-07-31 02:45:00 【rookieﻬ°】
我们废话不多说,直接上代码:
//这里我们设把一个10进制的数,转换为6进制的数(以此类推)
int main()
{
int n = 0;
scanf("%d", &n);
int change_num = 0;//设change_num为最终得到的结果
int ret = 1;//进制转换必须设的数
while (n)
{
change_num += ret * (n % 6);//重点!!
n /= 6;
ret *= 10;
}
printf("%d\n", change_num);
return 0;
}
言简意赅,喜欢的记得留下赞哦~~
边栏推荐
- 什么是分布式锁?实现分布式锁的三种方式
- MPPT太阳能充放电控制器数据采集-通过网关采集电池电压容量电量SOC,wifi传输
- 8. Unified exception handling (controller notifies @ControllerAdvice global configuration class, @ExceptionHandler handles exceptions uniformly)
- 全流程调度——MySQL与Sqoop
- Draw Your Cards
- 英特尔软硬优化,赋能东软加速智慧医疗时代到来
- YOLOV5学习笔记(二)——环境安装+运行+训练
- User interaction + formatted output
- 医疗影像领域AI软件开发流程
- AI中的数学思想
猜你喜欢
Hanyuan Hi-Tech 8-channel HDMI integrated multi-service high-definition video optical transceiver 8-channel HDMI video + 8-channel two-way audio + 8-channel 485 data + 8-channel E1 + 32-channel teleph
图解lower_bound&upper_bound
Multilingual settings of php website (IP address distinguishes domestic and foreign)
The effective square of the test (one question of the day 7/29)
The simulation application of common mode inductance is here, full of dry goods for everyone
6. Display comments and replies
mmdetection trains a model related command
Inter-vlan routing + static routing + NAT (PAT + static NAT) comprehensive experiment
10. Redis implements likes (Set) and obtains the total number of likes
12 磁盘相关命令
随机推荐
完整复制虚拟机原理(云计算)
AI在医疗影像设备全流程应用
Live Preview | KDD2022 Doctoral Dissertation Award Champion and Runner-up Dialogue
What level of software testing does it take to get a 9K job?
19. Support Vector Machines - Intuitive Understanding of Optimization Objectives and Large Spacing
How to build a private yum source
Maximum area of solar panel od js
Huawei od dice js
Clustering index, and what is the difference between a clustering index
【C语言基础】解决C语言error: expected ‘;‘, ‘,‘ or ‘)‘ before ‘&‘ token
8、统一处理异常(控制器通知@ControllerAdvice全局配置类、@ExceptionHandler统一处理异常)
Unity3D Button mouse hover enter and mouse hover exit button events
10. Redis implements likes (Set) and obtains the total number of likes
你们程序员为什么不靠自己的项目谋生?而必须为其他人打工?
16、热帖排行
Drools Rule Properties, Advanced Syntax
Refuse to work overtime, a productivity tool set developed by programmers
The modification is not properly placed in the sandbox, causing Apple compatibility issues
拒绝加班,程序员开发的效率工具集
【Bank Series Phase 1】People's Bank of China