I have this code and it works. It prints out the number, product, and sum, but I need it to be able to work with more than one number. For example if enter
45 6 70
I need it to say
Numbers: 45 6 70
Sum: 121
Product: 18900
How would I go about doing that?
System.out.println("\nThe numbers are: ");
System.out.println(r);
for (int i = 0; i < r.length(); i++) {
a[i] = r.substring(i, i + 1);
sum = sum + Integer.parseInt(a[i]);
b[i] = Integer.parseInt(a[i]);
product = product * b[i];
}
System.out.println("\nThe sum of the numbers are " + sum );
System.out.println("\nThe product of the num are " + product);
}
}
}