MrJohnDoe MrJohnDoe
  • 11-03-2020
  • Computers and Technology
contestada

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.​

Respuesta :

problemsolver2019
problemsolver2019 problemsolver2019
  • 17-03-2020

Answer:

The logic is clear from below program in python

a= input("ENTER THE NUMBER")

i=0

sum1=0

while(i <= int(a)):

    sum1 =sum1+i

    i=i+1

print(sum1)

Explanation:

Start

Enter number; n

sum=0

for i =0 to n

sum =sum+i

Next i

Print sum

End

Answer Link

Otras preguntas

Which one of the following graphs is the graph of f(x) = 1∕4x2 + 3?
3. A belief shared by Presidents Theodore Roosevelt, William Taft, and Woodrow Wilson is that the Federal Government should A. allow the free-enterprise system
You roll a cube which has the numbers 9, 10, 12, 15, 17, and 18 on it You then spin a spinner which has 4 sections. The letters on the spinner are H, K, F, and
A rectangular paperboard measuring 29in long and 20in wide has a semicircle cut out of it, as shown below. Find the area of the paperboard that remains. Use the
I Need a 5-7 sentence paragraph about the picture down below.
Plz help me I can’t do it
2) 70 = -7a Please help me !
If f(x) = 2x ^ 2 + 3 and g(x) = x ^ 2 - 7 , find (f - g)(x) .
If tanA=1/7 and tanB=1/3 prove that cos2A=sin4B
find the transpose of matrics. Q=[789]