Calsoft Interview Question

coding problem in c# to implement