Respuesta :
Answer:
There's nothing wrong with the question you posted except that it's not well presented or arranged.
When properly formatted, the program will be error free and it'll run properly.
The programming language used in the question is Java programming lamguage.
in java, the sign ";" signifies the end of each line and lines that begins with // represent comments. Using this understanding of end of lines and comments, the formatted code goes thus
import java.util.Scanner; Â
public class Arraysum { Â
public static void main(String[] args) { Â
Scanner scnr = new Scanner(System.in); Â
final int NUM_ELEMENTS = 8;
// Number of elements Â
int[] userVals = new int[NUM_ELEMENTS]; Â
// User numbers Â
int i = 0; Â
// Loop index Â
int sumVal = 0; Â
// For computing sum Â
// Prompt user to populate array Â
System.out.println("Enter " + NUM_ELEMENTS + " integer values..."); Â
for (i = 0; i < NUM_ELEMENTS; ++i) { Â
System.out.print("Value: "); Â
userVals[i] = scnr.nextInt(); Â
} Â
// Determine sum Â
sumVal = 0;
for (i = 0; i < NUM_ELEMENTS; ++i)
{
sumVal = sumVal + userVals[i];
}
System.out.println("Sum: " + sumVal); return;
}
}
Also, see attachment for source file