Problem solving with pascal alogarithm and program design