implemented ex9 task_c