进制转换
/*
功能:进制转换
日期:2013-06-08
*/
#include<stdio.h>
#include<stdlib.h>
void convertHex (int x);
int main(void)
{
int num;
printf("请输入一个十进制数字:");
scanf("%d",&num);
printf("%d的二进制为:",num);
convertHex(num);
printf("n");
system("pause");
}
void convertHex (int x)
{ int remainder;
if (x==0)
{
return;
}
remainder = x % 2;
x = x / 2;
convertHex(x);
printf("%d",remainder);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
预览
除特别注明外,本站所有文章均为 Windcoder网 原创,转载请注明出处来自: binary-conversion
Loading comments...

预览
暂无数据