Program 1:


Program 2: