题目:十进制 转 二进制 的算法
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int number;
int array[999];
int i = 0, j = 0, count = 0;
printf("请输入一个整数:");
scanf("%d", &number);
while(number/2)
{
i = number%2;
array[j] = i;
j++;
count++;
number = number/2;
}
printf("转化为二进制数为:");
array[count] = 1;
printf("%d", array[count]);
for(j=count-1; j>=0; j--)
{
printf("%d", array[j]);
}
printf("\n");
system("pause");
return 0;
}