buddy, i want that program using recursion.. i was unable to solve that problem.. so i need ur help guys.. sorry i forgot to mention recursion in my first post....
I tried the search I suggested and quickly found your last thread on the same subject.
http://www.cplusplus.com/forum/beginner/40696/
Was it not solved well enough in this previous thread of yours?
You checked it as solved.
What question remains?
EDIT: That's right, you want it to run in main() only. You can't call main() recursively.