Write a program that accepts numeric command line arguments and adds all of
them. For example, if the argument list is: 100 100 134 150 300 200
The output should be: 984
public class Main {
public static void main(String[] args) {
int sum = 0;
for (String argument : args) {
sum += Integer.parseInt(argument);
}
System.out.println(sum);
}
}
Comments
Leave a comment