updated problem4.c