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
A bulb has a resistance of 15Ω and is rated at 3A. What is the maximum voltage that can be applied across the bulb?
Anastasy [175]

Answer:Wheres the option choice??????????????????????

Explanation:

7 0
2 years ago
Which of the following questions will most likely be answered by displaying data on a line graph?
Neko [114]
It would be A because B could be answered best with a poll graph, C with a pie graph, and D with a bar graph. Line graphs typically show speed and rate so A makes the most sense, but you are still able to do the other questions on a line graph.
4 0
3 years ago
Does anyone go to connections acadomy​
Komok [63]

Answer:

no I dont where is that at

7 0
2 years ago
Read 2 more answers
Phân tích vai trò của các yếu tố trong biên tập Audio và Video
Paul [167]

Answer:

Answer to the following question is as follows;

Explanation:

A visual language may go a long way without even text or narrative. Introductory angles, action shots, and tracker shots may all be utilised to build a narrative, but you must be mindful of the storey being conveyed at all times. When it comes to video editing, it's often best to be as cautious as possible.

6 0
3 years ago
With this type of memory, large programs are divided into parts and the parts are stored on a secondary device, usually a hard d
-Dominant- [34]
The answer to this question is the term virtual memory. A virtual memory is a type of memory that uses a secondary memory which is implemented on hardware and software. A virtual memory maps and combines virtual addresses into a physical address inside the computer memory and operating system controls the memory into virtual memory.
8 0
2 years ago
Other questions:
  • A retail company assigns a $5000 store bonus if monthly sales are $100,000 or more. Additionally, if their sales exceed 125% or
    5·1 answer
  • Select the correct answer.
    15·1 answer
  • In this scenario, what is the importance of anti-virus software and other similar virus protection programs?
    11·1 answer
  • When is e-mail an appropriate channel for goodwill messages? If you frequently communicate with the receiver by e-mail and are c
    15·1 answer
  • What kind of printer is used with multipart forms such as those with point of sale machines?A) dot-matrixB) daisy-wheelC) inkjet
    5·1 answer
  • The velocity dimension of Big Data refers to _____.
    15·1 answer
  • Define Turbo C++ and how is the use of Turbo C++.?
    15·1 answer
  • Misspelet errors are displays with a ...<br>.. below them<br>​
    10·1 answer
  • Select the correct answer.
    13·2 answers
  • 1. What does the term 'in season' mean?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!