Print prime numbers using a for loop