#include<stdio.h>
void change(size_t n)
{
size_t b=n/2;
size_t r=n%2;
if(b)
change(b);
printf("%d",r);
}
int main()
{
size_t n;
char ch;
while(1)
{
printf("\ninput a nmber:");
scanf("%d",&n);
while((ch=getchar())!='\n'&&ch!=EOF);
printf("result:");
change(n);
}
}
追问看不懂啊,可不可以用最基础的代码,今天刚学的
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/7acb0a46f21fbe09bf27908760600c338744ad2c?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
我这个可不可以改
我输出答案是相反的
追答你输出反的,就在while循环外加个变量i,循环*10,循环内b=b+i*(a%2);