if (num<smallest) {
smallest=num;
numCounter = counter;
}

Thankfully you don't have to pay a dollar everytime you use a {} pair.