180k views
3 votes
Design the logic for a program that allows a user to enter a number. Display the sum of every number from 1 through the entered number. In pseudocode or flow chart.

1 Answer

5 votes

Answer:

START

DECLARE total_sum = 0

DISPLAY "Enter a number: "

GET user_input

FOR i from 1 to user_input:

SET total_sum = total_sum + i

END FOR

DISPLAY "The sum of every number from 1 through " + user_input + " is " + total_sum

END

User Arul
by
7.9k points