Answer:
The source code and output is attached.
I hope it will help you!
Step-by-step explanation:
9.5m questions
12.2m answers