我完全卡住,在此代码中,此代码旨在 找到由两个3位数字的乘积制成的最大回文。 我已经写的代码对于这样的:奇怪的行为输出
#include <stdio.h>
void main()
{
unsigned long long int mul = 1, temp = 0, reverse = 0, pelindromenum=0;
int i, j;
for (i=100;i <=999;i++)
{
for(j=i;j<=999;j++)
{
mul = i*j;
temp = mul;
while (temp != 0)
{
reverse = reverse * 10;
reverse = reverse + temp%10;
temp = temp/10;
}
if (reverse == mul)
{
if (pelindromenum <= mul)
{
pelindromenum = mul;
}
}
}
}
printf ("%llu", pelindromenum);
}
这是给outut 0.我无法理解为什么它给0,我去通过代码很多次,但我无法找到任何问题,请帮助我在这里。
感谢
'INT主要(无效)'...'返回0;'请^^ – 2012-02-08 10:53:13
欢迎(因此),这是一个关于编程问题的论坛,而不是调试源代码的地方。您可能想要阅读优秀的[如何调试小程序](ericlippert.com/2014/03/05/how-to-debug-small-programs/) – 2014-03-11 14:56:27