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
Rasek [7]
3 years ago
7

Write a for loop that computes the following sum: 5+10+15+20+...+485+490+495+500. The sum should be placed in a variable sum tha

t has already been declared and initialized to 0. In addition, there is another variable, num that has also been declared. You must not use any other variables.
Computers and Technology
1 answer:
Strike441 [17]3 years ago
6 0

Answer:

public class num9 {

   public static void main(String[] args) {

       int sum =0;

       int num =5;

       for(num =5; num<=500; num+=5){

           System.out.println(num);

           sum +=num;

       }

       System.out.println(sum);

   }

}

Explanation:

  • Declare and initialize the variables sum and num
  • Use a for loop with the condition for(num =5; num<=500; num+=5) Since the loop will increment by 5 and run from 5 to 500
  • Within the loop, add num to sum at each iteration
  • Print all elements on seperate lines
  • Outside the loop, print the final value of sum

Create a for loop

You might be interested in
Which of the following is a way to prevent wastes from contaminating the environment? A) Use absorbent pads to collect floor was
Firlakuza [10]

Answer

Dispose of absorbents as hazardous waste in its own hazardous waste container

Explanation

Hazardous waste is a waste that has chemical composition and properties which makes it capable of causing illness, death  or harm to humans and other life forms when released to the environment without proper management. The characteristics of such wastes include: toxic, ecotoxic, infectious substance, poisonous, explosive and flammability. Hazardous wastes can be destroyed by incineration, chemical process, and temporary on-site waste storage facilities such as waste piles and lagoons/ponds



8 0
3 years ago
Read 2 more answers
In the following cell, we've loaded the text of Pride and Prejudice by Jane Austen, split it into individual words, and stored t
Sever21 [200]

Answer:

Explanation:

Since the array is not provided, I created a Python function that takes in the array and loops through it counting all of the words that are longer than 5. Then it returns the variable longer_than_five. To test this function I created an array of words based on the synapse of Pride and Prejudice. The output can be seen in the attached picture below.

def countWords(p_and_p_words):

   longer_than_five = 0

   for word in p_and_p_words:

       if len(word) > 5:

           longer_than_five += 1

   return longer_than_five

7 0
3 years ago
With which of these enterprise platform businesses does Accenture hold a partnership?
prohojiy [21]

Answer: SAP and Salesforce.

Explanation:

Accenture's partnership with SAP and Salesforce is vital in helping clients progress toward the achievement of their environmental, social, and governance goals.

The partnership will help combine Salesforce Sustainability Cloud with the consulting practice of Accenture’s Sustainability Services. With this partnership, companies can embed sustainability into their business as companies are advised on how to move to low carbon energy, and cloud na how these can help improve their business.

5 0
3 years ago
Program ____ let programmers write code using a word processing-like interface.​
kati45 [8]
<span>Program "editor" </span>let programmers write code using a word processing-like interface.​

This is utilized by programming software engineers; gives them a chance to compose code utilizing a word processing like interface that usually includes functions, like, AutoCorrect and AutoComplete.it is also called text editor.
3 0
3 years ago
Which of the following is a way to sell the network proposal to management?Group of answer choicestalk about upgrades from 10Mbp
Assoli18 [71]
Ethernet is the best in reliability and speed
5 0
3 years ago
Other questions:
  • 1.
    13·1 answer
  • The ____________ is a wildcard character that is used to search for an unknown single character.
    6·1 answer
  • Lydia noticed that she feels tired and out of breath after walking her dog up a hill in the park. Which area of fitness does she
    8·1 answer
  • How do you enter the command prompt on Chromebook
    10·1 answer
  • "The _____ of the Open Systems Interconnection (OSI) model generates the receiver’s address and ensures the integrity of message
    6·2 answers
  • 2:3:5<br>_ _ _<br>3 2 8<br><br><br><br>find ratio​
    5·1 answer
  • Jane is creating a slide that will have a large heading and number of bullet points below it. What slide format should she use?
    12·1 answer
  • Supp guees how your dayyyyyyyyyyyy
    10·2 answers
  • I need a utube name for a gaming channel....PLEASE HELP...BRAINLIEST
    5·1 answer
  • Digital Sep <br> helps as reimagine outcomes true or false
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!