Find smallest and largest element in array

I had understand logic behind code but when I entered very smallest value as input in array like 10 23 68 5 12. then largest value found but smallest value give no 2147483647 as in output. this value is largest value of INT_MAX. But why it throw this no. as smallest I didn’t get this.

send me the link of your code

save your code at ide.codingblocks.com
and then send the link generated

I have written same code which is given in binary search lecture.

this code is for binary search
but i think you asked about
Find smallest and largest element in array
??

sorry for inconvenience. I wrote new code of smallest and largest element in array
plz check it.

Correct Condition is this
if(a[i]<smallest){}
if current element is smaller than the smallest then you update the smallest

Modified Code

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.