i have written the code but it is not working . please see towards it
Arrays -max value in array
whats the error in the above code
@Ritesh_jindal
The comparision of a[i] with max number is outside the loop, the brackets are not put correctly.
Also the update of max_number is not done.
I have corrected your code, have a look and ask if there is any doubt https://ide.codingblocks.com/s/251385
It is clear now then please mark this doubt as resolved.
@Ritesh_jindal
initialize max_number with INT_MIN not zero, because according to the given constraints the numbers can be negative, so lets suppose arr is -1,-2,-3 then in that case answer is -1 but your code will print 0
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.