Buy a copy of 'test your C skills' by yashwanth kanetkar and try solving on your own, cross check with the given answers.