Deloitte Interview Question

Basic cpp and java codes