Quote:
i tried nested loop but its not working.
Show your code and we will help you to fix it.
You show no attempt to solve the problem yourself, you have no question, your main effort is pasting the requirement, you just want us to do your HomeWork.
HomeWork problems are simplified versions of the kind of problems you will have to solve in real life, their
purpose is
learning and
practicing.
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
If you think I am rude to you, remember that you were first to be rude by requesting us to do your homework.
Even the analyze of Solution is part of your homework, you also have to learn do conduct such analyze, it is the job of programmer.
As I said training, practice, trial and error that is how you will learn.