Thanks a lot Mr. jules now the code is working perfectly for higher values , the problem was with ord .