Hi Shilpa, After completing the loop for(int j=3;j>0;j--), the value of som is 2 and again variable som is changed by the expression som=som-i which makes som 0.So far so good now with i=2 and j=2 the value of som comes to -1 which is awkward for an arrays index.So the runtime raises the exception array index out of bounds.You have to find a way so that som doesnt fall beyond 0. cheers Rajesh