The first code that I made is this...
for (i = 0; startNum + i <= endNum; i++)
{
num = startNum + i; // num도 100부터 시작
while (1) // 고집수를 확인하기 위함
{
doubleNum = transNumber(num); // 각 자리 수의 곱의 값
count = count + 1;
if (doubleNum < 10) {break;}
num = doubleNum;
}
The second code is the following
for (i = 0; startNum + i <= endNum; i++){
num = startNum + i; // num도 100부터 시작
count = 0;
while (num > 10) {
num = transNumber(num);
count++;
}
if (count == goNum)
{
printf("%d\n", startNum + i);
count2 = count2 + 1;
}
}
What I thought is that if I make a new variable doubleNum, then it would keep taking in the result of transNumber. Also, since I put the if statement, then it would be the same code as the first code...
However, the results are clearly different, and I'm wondering if there could be a specific explanation for this?
Aucun commentaire:
Enregistrer un commentaire