1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-12-16 15:44:39 +00:00
202401-programming-assignments/【实践课内】11.函数2/6-3 十进制转换二进制.md

39 lines
543 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 6-3 十进制转换二进制
本题要求实现一个函数将非负整数n转换为二进制后输出。
### 函数接口定义:
```c++
void dectobin( int n );
```
函数`dectobin`应在一行中打印出二进制的`n`。建议用递归实现。
### 裁判测试程序样例:
```c++
#include <stdio.h>
void dectobin( int n );
int main()
{
int n;
scanf("%d", &n);
dectobin(n);
return 0;
}
/* 你的代码将被嵌在这里 */
```
### 输入样例:
```in
10
```
### 输出样例:
```out
1010
```