Hi , Lajos Thanks for your help, I think it is not the problem with i*nr+j , because I test the program with same value ni and nr.