A couple of things
- The main procedure returns an int and has to be declared accordingly.
- The corresponding closing brace ends the main procedure. Look where it is in your code. Count opening and closing braces and ensure they are balanced. (Proper code indentation helps a lot.)
- Initialize sum with 0 to be able to add the value of an element in each iteration of the loop. Consider to declare sum a float rather than an int.
- Initialize min with the first element (at index 0) in order to have a value to compare with.
- Declare another variable as int (e.g. indexOfMin) and initialize it with 0. Use it to remember the index of the current min value that you found.
- You don't need the Y array. You know now the index of the smallest element and thus, you can perform the replacement in the original array.