Quote:
Convert this code to C as I don't have a knowledge of C language syntax.
No. We are not a code conversion service, and we aren't here to do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Try it yourself, you may find it is not as difficult as you think!
If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
But I'll give you a little advice for free: a good C++ solution that seems to meet your homework question will not produce a good C solution. C++ is a superset of C, and works on a very different basis. It's like buying a Mustang engine for your Fiat 500 and expecting it to slot right in and make a good car ...