Discover a wealth of knowledge and get your questions answered on IDNLearn.com. Join our community to receive prompt, thorough responses from knowledgeable experts.
Answer:
Following is the program given in C++ language.
All the necessary comments are added into the program to make the concept clear.
I hope it will help you!
Explanation: