You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
final int LOWERBOUND = 1; // if you need to sum the nuber divisible by any number, change this one!!!
final int UPPERBOUND = 10;
int product = 1; // any product (multipler) need a value higher than 0 (also also: change the name so its clear-er)
int number = LOWERBOUND;
while (number <= UPPERBOUND) {
product = product * number; //here just insted of makingt the int of product sum the next (or the same), you multiply it (product) to the number that follows.
++number;
}
System.out.println("The sum of " + LOWERBOUND + " to " + UPPERBOUND + " is " + product);