I'm trying to create a while loop that outputs a list of values, adds them together, and outputs a total with an "=" sign at the end I.e., if the User enters the numbers 5 and 12, the output would show up like this: 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 = total
This is how my 'while' loop looks right now:
while(enteredNum1 <= enteredNum2){
total += enteredNum1;
document.write(enteredNum1 + " + ");
enteredNum1++;
}
document.write("= " + total);
I know it will always append the " + ", but can anyone point me in the right direction for having the last value show "=" instead of the "+" again?
enteredNum1and check if the loop will run again, if it will write the+otherwise carry on