C语言新手不小心搞了个无限循环的输出。求解
#include<stdio.h>int main(void)
{
int mm, nn, num, pointer;
printf("Input m, n: ");
scanf("%d,%d", &mm, &nn);
printf("\nResult:");
if (mm >= nn)
{
for (num = nn; num <= mm; num++)
{
if (num % 10 == 5 || num / 10 % 10 == 5 || num / 100 % 10 == 5 || num / 1000 % 10 == 5)
{
pointer = 1;
}
else
{
pointer = 0;
}
while (num % 3 == 0 && pointer == 1)
printf("%2d", num);
}
}
else
{
for (num = mm; num <= nn; num++)
{
if (num % 10 == 5 || num / 10 % 10 == 5 || num / 100 % 10 == 5 || num / 1000 % 10 == 5)
{
pointer = 1;
}
else
{
pointer = 0;
}
while (num % 3 == 0 && pointer == 1)
printf("%2d", num);
}
}
return 0;
}