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]
3 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]3 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
Computer __ is any part of the computer that can be seen and touched​
iogann1982 [59]
Hardware
Answer. physical parts of computer which can be seen and touched are called Hardware.
3 0
3 years ago
Does anyone play fortnite i want to be gifted vbucks please my epic is Springtrap_locks thx means a lot to me
Paladinen [302]

Answer:

This is not what this platform is supposed to be used for

Explanation:

Fortnite isnt a real game lol get a life

3 0
3 years ago
The Chief Information Officer (CIO) has determined the company’s new PKI will not use OCSP. The purpose of OCSP still needs to
Step2247 [10]

Answer:

B. Implement a key escrow.

Explanation:

A key escrow can be defined as a data security method of storing very essential cryptographic keys.

Simply stated, key escrow involves a user entrusting his or her cryptographic key to a third party for storage.

As a standard, each cryptographic key stored or kept in an escrow system are directly linked to the respective users and are encrypted in order to prevent breach, theft or unauthorized access.

Hence, the cryptographic keys kept in an escrow system are protected and would not be released to anyone other than the original user (owner).

In this scenario, the Chief Information Officer (CIO) has determined the company's new public key infrastructure (PKI) will not use online certificate status protocol (OCSP). However, the purpose of online certificate status protocol (OCSP) still needs to be addressed. Thus, what should be implemented is a key escrow because the online certificate status protocol (OCSP) is an internet protocol used for maintaining the security of a server and obtaining a digital certificate that has been revoked.

8 0
2 years ago
What is the fundamental goal of outsourcing? increased quality brand expansion cultural diversity cost savings
galben [10]

Answer:

Cost saving is the fundamental goal of outsourcing.

Explanation:

Initially the companies where outsourcing task only for Cost cutting. But nowadays, the companies do that for so many other reasons like, increase the efficiency, reducing overhead, to concentrate on core business peacefully, to obtain more profit, etc.  

The cultural diversity does not affect or make companies to outsource.

We can indirectly increase the quality but it is not the primary goal of outsourcing.  

Brand expansion will holds good, only the BPO is run under the name of the company. But this is once again not the major objective.

7 0
3 years ago
Which table code is correct?
lorasvet [3.4K]

Answer:  3rd one down

Explanation:

8 0
3 years ago
Other questions:
  • Alison retrieved data from a company database containing personal information on customers. When she looks at the SSN field, she
    14·1 answer
  • What type of device can be used to block unwanted traffic initiated from the internet and can also restrict internet access from
    6·1 answer
  • Which of the following describes ETL? a) A process that transforms information using a common set of enterprise definitions b) A
    14·1 answer
  • A security utility program that scans the system for small programs that interfere with how a computer functions are _____ utili
    13·1 answer
  • How does a typewriter involve math and science?
    10·2 answers
  • Wrtie down some containerization technology.
    11·1 answer
  • Fiber optic cables transfer data at the speed of light, so they have the __________ latency. This results in the ________ connec
    13·1 answer
  • Please help with this coding question
    8·2 answers
  • State 4 basic operation performed by a computer​
    11·2 answers
  • What steps can be used to password-protect a worksheet?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!