qfedu-c-level/day6/d6.c

34 lines
639 B
C
Raw Normal View History

2023-07-10 17:46:22 +08:00
#include <stdio.h>
int main()
{
int nums[5][3] = {0};
int n;
for (int i = 0; i < 5; i++)
{
printf("请输入第%d个三位数", i + 1);
scanf("%d", &n);
int m[] = {100, 10, 1};
int j = 0;
while (n > 0)
{
nums[i][j] = n / m[j];
n %= m[j];
j++;
}
}
for (int i = 0; i < 5; i++)
{
// 判断这个三位数是否为回文数
if (nums[i][0] == nums[i][2])
continue;
for (int j = 0; j < 3; j++)
{
printf("%d ", nums[i][j]);
}
printf("\n");
}
}