For your information this is not a homework question nor I am student expecting other people to do my work.I know the credibility of this forum and what forums are exactly for...I was just expecting some logic or some idea,to workaround for my problem.The code and the data which i have posted is not the exact one i am working on..johnny's code solution and the other person with algorithm gave me just an idea to use a condition to workaround actual my problem ..I just appreciated his efforts in helping me in the previous post,without seeing your post...
Posting complete code solutions is generally frowned upon, extra-especially for what is obviously a homework question.
I appreciate your care for the next generation students..nobody is a born star with computer programming skills,with only the continued efforts and hardwork,they become one,at times they do need help...to shine
The student must be left to sink-or-swim on there own merits... ..otherwise we risk turning out a whole generation of qualified know-nothings... and we don't want that... we want the stars to shine brightly, ..
and this is not how you respond to them....
the not-so-bright to realise there error and go study politics, law, or something equally drab
Even if you are not helpful plz dont discourage people who want to help others...
I know it's all pretty abstract, but please, even if you "don't get it" try to resist the temptation to be too helpful.