Max element in an array

https://ide.codingblocks.com/#/s/13981
sir,why does this code fails for negative numbers