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
Vladimir [108]
3 years ago
6

Use the variables k and total to write a while loop that computes the sum of the squares of the first 50 counting numbers, and a

ssociates that value with total. Thus your code should associate 11 22 33 ... 4949 50*50 with total. Use no variables other than k and total.
Computers and Technology
1 answer:
Tems11 [23]3 years ago
3 0

Answer:

total = 0

k = 1

while k <= 50:

total += k**2

k += 1

print(total)

Explanation:

Note: There some errors in the question. The correct complete question is therefore provided before answering the question as follows:

Use the variables k and total to write a while loop that computes the sum of the squares of the first 50 counting numbers, and associates that value with total. Thus your code should associate 1*1 + 2*2 + 3*3 +... + 49*49 + 50*50 with total. Use no variables other than k and total.

The answer is now explained as follows:

# Initialize k which is the number of term

k = 1

# Initialize total which is the sum of squares

total = 0

# Loop as long as k is less than or equal to 50.

while (k <= 50):

# Add the square of k to total in order to increase it

total = total + k * k

# Increase the value of k by one.

k += 1

# Finally, output total

print (total)

You might be interested in
A programmer wrote the program below. The program uses a list of numbers called numList. The program is intended to display the
Nezavi [6.7K]

Answer:

The conclusion is incorrect; using the test case [0, 1, 4, 5] is not sufficient to conclude the program is correct.

Explanation:

From the code snippet given, we cannot conclude that the test case is sufficient.

One of the reasons is because the test case contains only integer variables.

Tests need to be carried out for other large and floating points numerical data types such as decimal, double, float, etc. except that when it's known that the inputs will be of type integer only else, we can't rush into any conclusion about the code snippet

Another reason is that input are not gotten at runtime. Input gotten from runtime environment makes the program flexible enough.

Lastly, the array length of the array in the code segment is limited to 4. Flexible length needs to be tested before we can arrive at a reasonable conclusion.

8 0
4 years ago
How will you create a blog using Wordpress?​
levacccp [35]

Answer:

yes

Explanation:

8 0
3 years ago
Read 2 more answers
Which of these is NOT an advantage of the impact of computer careers.
nikdorinn [45]
I believe the answer could be the first choice. I'm not quite sure, though
4 0
3 years ago
Read 2 more answers
Which layer of the OSI model is responsible for ensuring flow control so that the destination station does not receive more pack
MrMuchimi

Answer:

The Layer 4 (Transport layer)

Explanation:

The transport layer is the fourth layer of the OSI (Open Systems Interconnection) model that is responsible for transmitting data between networking devices. Some of its other functions are;

i. It maintains flow control so that the destination station does not receive more packets than it can handle or process at a particular time.

ii. it also maintains error control so that the entire message (data) sent arrives at the layer without any error due to incompleteness, loss, damage or duplication.

6 0
4 years ago
Does this Java Program look correct? First, let me paste the question:Five friends are going to the theater. They have purchased
atroni [7]

Answer:

Your program is correct.

Explanation:

<u>You have this requeriments:</u>

  • James doesn't want to sit next to Jill.
  • Betty and Herb are dating and want to sit next to each other.
  • Bob must sit on an aisle.
  • Aisle on either end.

<u>Your answer:</u>

public class Seating{

public static void main (String [] args)

{ String James;

String Jill;

String Betty;

String Herb;

String Bob;

system.output.println(Bob + "," + Jill + "," + Herb + "," + Betty + "," + James + "."; } <em>//Bob is an aisle. James is not sit next to Jill. Betty and Herb are sit together.</em>

}

4 0
3 years ago
Other questions:
  • it is important to include the __ attribute of the tag because some people use text-only web browsers
    5·2 answers
  • Select the correct answer from each drop-down menu.
    10·1 answer
  • You approach a railroad crossing with a cross buck sign that has no light or gates . What should you do ?
    5·1 answer
  • Which one of the following provides an authentication mechanism that would be appropriate for pairing with a password to achieve
    13·1 answer
  • Answer to this if you have apex legends on either pc xbox one or PS4 for the one that answers and does gets brainliest please do
    7·2 answers
  • Write a for loop that sets each array element in bonusScores to the sum of itself and the next element, except for the last elem
    11·2 answers
  • What is an infodemic?
    10·1 answer
  • I hack3d into my schools computer system to unblock everything but now I am scared that I am going to get caught so I want to de
    13·2 answers
  • Create five circles like the Olympic Rings. fill them with the colors given below
    8·1 answer
  • What kind of charger can i use for this
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!