Wipro Interview Question

Ask me to write a code for the given scenario