here is the question generate a random integer n in the range from 5 to 9 then loop n times to: -prompt the user for an integer between 1 to 10 -print the sum of the numbers entered so far
here what I got:
n = randi([5,9]);totalsum = 0;runsum = 0;for i = n int = input('Enter an integer between 1 and 10 :'); runsum = runsum + int; totalsum = runsum + totalsum;end
I try to call up the loop, like, Enter an integer between 1 and 10 : 8 but it did not countinous to count up the sum
Can anyone have some suggestion for me?
Best Answer