Update Program4.c

Changes  made regarding making it more flexible and added some comments