Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

• Develop a program that will continuously take user input for numbers. These nu

ID: 3762110 • Letter: #

Question

•   Develop a program that will continuously take user input for numbers. These numbers will be added together and plotted. If the sum of these numbers exceeds 100, break from the loop (use a break statement). If the user input is greater than 25, do not add it to the sum (use a continue statement. Similarly, if the user input is less than -10, do not add it to the sum

this is the code i came up with:
x = 0;
n = input(' choose a number ');
for x = sum(n);
if n < -10 || n > 25
continue
end
if x == 100
break
end
disp(x)
end
but i want the program to keep asking for numbers

Explanation / Answer


sum = 0;
while (1)
   n = input(' choose a number ');
   if (n > -10 && n < 25)
       sum = sum + n;
       disp(sum);
       if (sum == 100)
           break;
       end
   end
  
end