This paper presents an iterative algorithm to approximate inequality constrained optimal control problems. The method uses Pontryagin's necessary conditions of optimality with a penalty method. The initial values of the adjoint vectorPsi(t), and the penalty coefficients are evaluated in such a way that the final conditions are satisfied and the extremal distances between the obtained trajectory and the constraints are imposed. The computing time is remarkably small. This method can treat linear problems with fixed or variable final time with mixed or simple constraints. A test problem is solved.