Using a for loop:
int firstBig(int i)
{
for(int k = i; k != 0; k = next(k))
{
if(k > 100) return k;
}
return 0;
}
Using a while loop:
int firstBig(int i)
{
int k = i;
while(k != 0)
{
if(k > 100) return k;
k = next(k);
}
return 0;
}