IBS Software Interview Question

Was given a scenario and asked to write a code