Pregunta de entrevista de Cognizant

Introduction 4 codes are based on Java