#include <conio.h>
#define MAX 20
main()
{
int n,i=0;
char ch[MAX];
printf("input the number:");
scanf("%d",&n);
itoa(n,ch,10);
while(ch[i]!='\0')
i++;
for (i--;i>=0;i--)
printf("%c",ch[i]);
getch();
}
----------------解决方案--------------------------------------------------------
给 变量i,s 赋初值!
----------------解决方案--------------------------------------------------------
#include<stdio.h>
void main()
{
int val,r;
val=0;
do{
printf("\n请输入一个数:");
scanf("%d",&val);
if(val<=0)
printf("该数必须为正数\n");
}while(val<=0);
do{
r = val % 10;
printf("%d",r);
val = val / 10;
}while(val != 0);
printf("\n");
}
----------------解决方案--------------------------------------------------------
类型不匹配
----------------解决方案--------------------------------------------------------
缺赋初值
----------------解决方案--------------------------------------------------------