问题
下面代码实现十进制数到二进制数的转换,请填空:( ) int main() { int input; scanf("%d", &input); int quotient = input;
下面代码实现十进制数到二进制数的转换,请填空:( )
int main()
{
int input;
scanf("%d", &input);
int quotient = input;
int remainder = 0;
int result = 0;
int time = 1;
while (quotient != 0 ) {
remainder = quotient % 2;
result = ______________________;
quotient = quotient / 2;
time *= 10;
}
printf("%d\n",result);
return 0;
}
A、 remainder * time
B、 result+remainder * time
C、 result+remainder
D、 result+time
您可能感兴趣的试题
-
设p1和p2是指向同一个字符串的指针变量,c为字符变量,则以下不能正确执行的赋值语句是_______.
设p1和p2是指向同一个字符串的指针变量,c为字符变量,则以下不能正确执行的赋值语句是_______.A、 c=*p1+*p2 B、 p2=c C、 p1=p2 D、 c=*p1*(*p2)...
查看答案 -
在C语言中,文件存取的单位是:( )
在C语言中,文件存取的单位是:( )A、 记录B、 元素C、 字节D、 文件...
查看答案 -
若有以下定义,则p+5表示_______. int a[10],*p=a;
若有以下定义,则p+5表示_______. int a[10],*p=a;A、 元素a[5]的地址 B、 元素a[5]的值 C、 元素a[6]的地址 D、 元素a[6]的值...
查看答案 -
下面程序段的运行结果是________. char *s="abcde"; s+=2;printf("%s",s);
下面程序段的运行结果是________. char *s="abcde"; s+=2;printf("%s",s);A、 cde B、 字符'c' C、 字符'c'的地址 D、 无确定的输出结果...
查看答案 -
变量的指针,其含义是指该变量的________.
变量的指针,其含义是指该变量的________. A、 值 B、 地址 C、 名 D、 一个标志...
查看答案
