Rearrange the code to find and print the smallest element of the array (n is the size 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 (n is the size of the array).

for(int x=1; x<n; x++) { } cout << small; small = arr[x]; if(arr[x] < small) int small = arr[0];

17th Oct 2016, 10:35 AM
anjanel macalaguim
2 Answers
+ 3
int small = arr[0]; for(int x=1; x<n; x++) { if(arr[x] < small) small = arr[x]; } cout << small;
17th Oct 2016, 11:03 AM
Zen
Zen - avatar
0
thank youuuuuuuuuuuuuuuuuuuuuuuuuu :*
20th Oct 2016, 1:34 PM
anjanel macalaguim