Rearrange the code to find and print the smallest element of the array. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Rearrange the code to find and print the smallest element of the array.

int small= arr[0]; for(int x=1; x<n; x++){ if( arr[x]<small small= arr[x]; } cout<<small; if my arrangement is wrong then please correct me??

4th Nov 2016, 7:35 PM
zerin jawah
zerin jawah - avatar
1 Answer
+ 3
No problem in arrangement.
4th Nov 2016, 7:45 PM
Sumita Das
Sumita Das - avatar