Hi team, Pls provide logic for this problem.Tq

Also have a look here for Non-LINQ. LINQ Approaches