1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
dmitriy555 [2]
2 years ago
6

a) Write a program that prompts for an integer—let’s call it X—and then finds the sum of X consecutive integers starting at 1. T

hat is, if X=5, you will find the sum of 1+2+3+4+5=15.b) Modify your program by enclosing your loop in another loop so that you can find consecutive sums. For example , if 5 is entered, you will find five sum of consecutive numbers:1 = 11+2 = 31+2+3 =61+2+3+4 =101+2+3+4+5 =15Print only each sum, not the arithmetic expression.
Computers and Technology
1 answer:
Alex73 [517]2 years ago
7 0

Answer:

<u>Solution a</u>

  1. n = int(input("Enter an integer: "))
  2. sum = 0
  3. for x in range(1, n+1):
  4.    sum += x  
  5. print(sum)

<u>Solution b</u>

  1. n = int(input("Enter an integer: "))
  2. for a in range(1, n + 1):
  3.    sum = 0
  4.    for x in range(1, a+1):
  5.        sum += x
  6.    print(sum)

Explanation:

Solution code is written in Python 3.

<u>Solution a</u>

First get the user input for an integer (Line 1).

Create a variable sum and initialize it with zero value (Line 3).

Create a for loop to traverse through the number from 1 to integer n (inclusive) and sum up the current number x (Line 5-6).

Print the sum to terminal (Line 8).

<u>Solution b</u>

Create an outer for loop that traverse through the number from 1 to integer n (inclusive) (Line 3).

Create an inner loop that traverse through the number from 1 to current a value from the outer loop and sum up the current x value (Line 5-6).

Print the sum to terminal (Line 7) and proceed to next iteration and reset the sum to zero (Line 4).

You might be interested in
In 1-2 sentences, describe some keyboard shortcuts you have used during this lesson to save you time.
Aneli [31]
Command C command V command A
5 0
2 years ago
Read 2 more answers
"As a ____ database management system, Access is particularly powerful because you can enter data once and then retrieve informa
Galina-37 [17]

Answer:

d.Relational

Explanation:

With the help of Access users can successfully manage valuable information by saving it easily for future reporting it , and analysis.In access users can have access to organized data in their database with minimal effort.

You can enter the data and you can select which data you want and use queries for that accordingly for example:- joins,select statements etc.

7 0
3 years ago
As a prospective student, what is the best reason to request an interview with your college application?
weqwewe [10]

Answer: The correct answer is A. I just answered this question myself!

6 0
2 years ago
Items that are cut or copied are placed on the Clipboard.
WINSTONCH [101]

Anwer is <u>True</u>

please mark me brainliest answer

7 0
3 years ago
Read 2 more answers
What is the statement describing? Agile team continuously adapt to new circumstances and enhance the methods of value delivery
Vera_Pavlovna [14]

Answer:

Continuous Integration

Explanation:

In continuous integration process, A program or piece of code is edited, tested and validated by team of software developers or contributors to complete and deploy the single project. This practice will improve the quality and reliability of the code.

Improvement, delivery and deployment are the three different phases, to complete the process of continuous integration.The individuals who contribute in a code or program  in terms of improvement, delivery and deployment make a team that leads to continuous integration.

So, Agile team Continuously adapt Continuous Integration to new circumstances and enhance the methods of value delivery.

8 0
3 years ago
Other questions:
  • Exit network systems, information support, and software development are all careers in which career cluster?
    10·1 answer
  • Why are computer programs so much longer now than they were in the late 1980?
    8·1 answer
  • The most common types of utility programs fall into these categories. accessibility calculation communication data entry enterta
    6·2 answers
  • Which attribute of the image tag specifies the URL of an image
    14·1 answer
  • Complete the function void update (int *a, int *b), which reads two integers as argument, and sets a with the sum of them, and b
    8·1 answer
  • Int a=10 int b=20<br> A=b<br> The new values for a and b are
    11·2 answers
  • With _______, applications are owned, delivered and managed remotely by one or more providers over the Internet or an intranet,
    15·1 answer
  • Impaired drivers are one of the many risks drivers face on the Highway Transportation System. List 3 signs that a driver could b
    10·2 answers
  • You have been trying all day to check your direct messages on social media. The site is really slow to load and sometimes you ca
    13·1 answer
  • Write a Temperature class that represents temperatures in degrees in both Celsius and Fahrenheit. Use a floating-point number fo
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!