Update main.c

Final working code submitted as the assignment.