int main()
{
int a;
int count=0;
int temp1[16];
int temp2[16];
scanf("%d",&a);
while(count<32)
{
temp1[count/2]=a%2;
a=a>>1;
count++;
temp2[(count-1)/2]=a%2;
a=a>>1;
count++;
}
printf("奇数列的二进制数序列为\n");
for(count=15;count>=0;count--)
printf("%d",temp1[count]);
printf("\n偶数列的二进制数序列为\n");
for(count=15;count>=0;count--)
printf("%d",temp2[count]);
return 0;
}
{
int a;
int count=0;
int temp1[16];
int temp2[16];
scanf("%d",&a);
while(count<32)
{
temp1[count/2]=a%2;
a=a>>1;
count++;
temp2[(count-1)/2]=a%2;
a=a>>1;
count++;
}
printf("奇数列的二进制数序列为\n");
for(count=15;count>=0;count--)
printf("%d",temp1[count]);
printf("\n偶数列的二进制数序列为\n");
for(count=15;count>=0;count--)
printf("%d",temp2[count]);
return 0;
}
本文介绍了一个使用C语言实现的程序,该程序能够接收一个整数输入,并将其转换为二进制形式,分别输出奇数位和偶数位对应的二进制序列。通过对输入整数进行位操作,程序能够有效地将数字转换为二进制并按要求格式输出。
322

被折叠的 条评论
为什么被折叠?



