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 type of computer are todays most widely used personal computers?
iris [78.8K]

Answer:

Windows 10. :)

Explanation:

8 0
3 years ago
Read 2 more answers
How do you get access To The advance server in Mobile legends
kiruha [24]

Answer: To enter the Advanced Server, please follow the below instructions: Tap into the Profile section and click Account Settings. Tap on the Switch Server button on the bottom right of the screen. This will allow the player to switch between the Original Server and Advanced Server.

Explanation: I play Mobile legends a lot so I know this

4 0
2 years ago
Select all that apply.
Serhud [2]

Answer:

Page grouping

Page Setup grouping

Layout grouping

Schemes grouping

4 0
3 years ago
How are overhead projectors being used to improve teaching and learning in the classroom?
baherus [9]
<span>Projects are easier to organize in programs like PowerPoint. Also it is definitely a lot less Complicated than a chalkboard or a whiteboard.</span>
6 0
3 years ago
Read 2 more answers
Is this good connection to be able to record edit and post videos?
Sholpan [36]

Answer:

The answer to your query is Yes and the details are in explanation section.

Explanation:

The general rule video is

  • if you have 3 MB speed is enough for normal video.
  • 5 MB for HD
  • 25 MB for HDR or 4K

For the above it is clear that yes your connection is good enough for videos.

but it lack in HDR or 4K  videos.

4 0
2 years ago
Other questions:
  • #A year is considered a leap year if it abides by the #following rules: # # - Every 4th year IS a leap year, EXCEPT... # - Every
    5·1 answer
  • If you define CSS rules on a parent control, the rules will be inherited by all of the children widgets.
    12·1 answer
  • How can you differentiate between standard and protocol? Write at least on example of each of these terminologies?
    12·1 answer
  • What do you think about the use the top song on a video you are creating
    8·2 answers
  • 11.
    11·1 answer
  • What best describes the advantage of using the model of a food web?
    12·2 answers
  • What type of information is kept on a database?
    10·1 answer
  • Given four inputs: a, b, c &amp; d, where (a, b) represents a 2-bit unsigned binary number X; and (c, d) represents a 2-bit unsi
    6·1 answer
  • Which of these components is a part of the Central Processing Unit (CPU) of a computer?
    11·2 answers
  • Create a database with information about products in a catalog. As you plan, keep in mind that later you will want to sort this
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!