简单c语言 检错

来源:百度知道 编辑:UC知道 时间:2024/05/16 14:01:33
#include "stdio.h"
int fun(int b)
{int c;
c=b%10;
printf("%d\t",c);
b=b/10;
return b;
}
void main()
{
int a,b;
printf("请输入");
scanf("%d",&a);
b=a;
while(b!=0)
fun(b);
}
帮我看看有什么错误!
我想输入一个数,以字符形式逆向输出

你的b没有返回来,加上b=fun(b)就对了。。
#include "stdio.h"
int fun(int b)
{int c;
c=b%10;
printf("%d\t",c);
b=b/10;
return b;
}
void main()
{
int a,b;
printf("请输入");
scanf("%d",&a);
b=a;
while(b!=0) {
b=fun(b);
}
}

#include "stdio.h"
int fun(int b) //这里要用b的引用,不然b的值是不会改变的
{int c;
c=b%10;
printf("%d\t",c); //这里的\t根据你的需要添加
b=b/10;
return b;
}
void main()
{
int a,b;
printf("请输入");
scanf("%d",&a);
b=a;
while(b!=0)
fun(b);
}