trying to solve using iterative process pascal