Global Payments Interview Question

debug the code given by them