#include <stdio.h>
#define NR 100
int answer(int a)
{
int t,bit = 1;
int i,j,m;
int array[NR + 1] = {0};
t = a;
while (t > 0) {
t = t/10;
bit += 1;
}
for (i =0; i < bit; i++) {
for (j = 0,m = 1; j < i; j++) {
m *= 10;
}
array[i] = a/m%10;
printf("%d\n",array[i]);
}
if (array[2] == 0)
return 0;
else
return 1;
}
测试第三位的代码:
int main()
{
int a;
printf("Input number:\n");
scanf("%d",&a);
printf("%d",answer(a));
printf("The answer is tested already!\Is your want?\n"
," sorry! lasttime!\n");
}
认真起来还是有收获的,哈哈,谢谢楼主了!
#define NR 100
int answer(int a)
{
int t,bit = 1;
int i,j,m;
int array[NR + 1] = {0};
t = a;
while (t > 0) {
t = t/10;
bit += 1;
}
for (i =0; i < bit; i++) {
for (j = 0,m = 1; j < i; j++) {
m *= 10;
}
array[i] = a/m%10;
printf("%d\n",array[i]);
}
if (array[2] == 0)
return 0;
else
return 1;
}
测试第三位的代码:
int main()
{
int a;
printf("Input number:\n");
scanf("%d",&a);
printf("%d",answer(a));
printf("The answer is tested already!\Is your want?\n"
," sorry! lasttime!\n");
}
认真起来还是有收获的,哈哈,谢谢楼主了!