IDNLearn.com: Your trusted platform for finding precise and reliable answers. Join our Q&A platform to get accurate and thorough answers to all your pressing questions.
Sagot :
Answer:
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("How many numbers do you want to add?");
int numberOfNumbers = scanner.nextInt();
int arrayNumbers[] = new int[numberOfNumbers];
System.out.println("Enter " + numberOfNumbers + " numbers:\n");
for(int i = 0; i < numberOfNumbers; i++){
int addToArray = scanner.nextInt();
arrayNumbers[i] = addToArray;
}
int sum = 0;
for(int j = 0; j < arrayNumbers.length; j++){
sum+=arrayNumbers[j];
}
System.out.println("Sum: " + sum);
}
}
Explanation:
We appreciate your contributions to this forum. Don't forget to check back for the latest answers. Keep asking, answering, and sharing useful information. Discover the answers you need at IDNLearn.com. Thank you for visiting, and we hope to see you again for more solutions.