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
By definition, a computer
lapo4ka [179]

Answer has a screen

Explanation:

a computer has a screen

5 0
2 years ago
Use the drop-down menus to complete the statements about integrating pictures and text in a Word document.
FrozenT [24]

Answer:

1. Move with text

2. Fix position on page

3. Remove background

Explanation:

EDGE 2021

7 0
3 years ago
Read 2 more answers
Pomelo and Calamansi Trees are type of plants that suitable in this method.A. Cleft-Grafting B. Marcotting C. Layering D. T-Budd
Olegator [25]
Pomelo and Calamansi Trees are type of plants that suitable in this method.A. Cleft-Grafting
8 0
2 years ago
Write a program that has two variables, start and end which represent beginning and end of segment, including start and end, whi
mr_godi [17]

The program illustrates the concepts of loops and conditional statements.

<h3>The complete program</h3>

The program written in Python, where comments are used to explain each line is as follows:

start = int(input())

end = int(input())

for i in range(start, end+1):

    if i%3 == 0 and i % 6 !=0:

         print(i,end = " ")

Read more about python programs at:

brainly.com/question/13246781

#SPJ1

4 0
2 years ago
What are the two features of EDIAC ?​
Sergio [31]

Answer:

By the numbers: “The ENIAC contained 17,468 vacuum tubes, along with 70,000 resistors, 10,000 capacitors, 1,500 relays, 6,000 manual switches and 5 million soldered joints. It covered 1,800 square feet (167 square meters) of floor space, weighed 30 tons, consumed 160 kilowatts of electrical power.” More info

3 0
2 years ago
Other questions:
  • What is MARC? Discuss structure of MARC
    8·1 answer
  • The contents of an array of type ______ can be displayed with the cout operator (without specifying an element). - 1 point(s)
    14·1 answer
  • Drag each storage device to its category.
    7·1 answer
  • Writing anything that comes to mind that may relate to your personal essay is called:
    15·2 answers
  • Which is the correct formula to add the values in cells A1 and B1?
    11·2 answers
  • Select the correct answer. Hudson has to maintain confidential college data in a spreadsheet. He needs two team members to help
    14·1 answer
  • Consider a network of 8 routers connected together to provide more than one path of connectivity between host A and host B at tw
    8·1 answer
  • Help me with this, please. Are vacuum cleaners, Cd players, and telephones considered computers? Do they store any data or proce
    8·2 answers
  • Which of the following is true of functions?
    10·1 answer
  • Why doesn't the ad load ?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!