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]
2 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]2 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
The Olympic Games that people celebrate today are much different from the Olympics that began in ancient Greece. When the Olympi
kiruha [24]

Answer:

D

Explanation:

Option D explains the best about Olympic games. previously only few games were in Olympics but now thee are variety of games and some more games are trying to be a part of future Olympic games as well. There is no explanation about other options so we discarded those options, Which includes A) Greek mythology says that the Olympics were started by Heracles. B) Women were not allowed to watch the Olympic Games in ancient Greece. C) The ancient Olympics included sport such as running and chariot racing.

8 0
3 years ago
Read 2 more answers
Which range of values would result in 10 elements stored in an array?
Paraphin [41]

Answer:

0-9

Explanation:

count 0 as 1

len(0,1,2,3,4,5,6,7,8,9)=10

3 0
3 years ago
Assume values 10, 20, 30, and 40 are entered in the cell range A1:A4. Cell A10 contains the formula: =A1+A2+A3+A4 and displays v
r-ruslan [8.4K]

Answer:

The formula and value to this question is "=A1+A3+A4+A5 with value 100"

Explanation:

The explanation of the given question as follows:

  • In question, it is defined that four cells that are "A1, A2, A3, and A4"  contains value that are "10, 20, 30, and 40".
  • To add these values we use addition formula that is "=A1+A2+A3+A4". it will give value 100.
  • If the user inserts a new row that is "A2" and assigns a value in the cell that is "50" so, we use the above formula that adds values with these values we also use the value "100".
8 0
2 years ago
What is the purpose of an index page feature in a Word document? Check all that apply.
Delvig [45]

Answer:

A. Helps to quickly find information in a document

B. Points readers to specific page numbers

D. Locates specific sections within a document

4 0
2 years ago
Read 2 more answers
Hypertension occurs when blood pressure is too high.
Ivan
True, hypertension is when your blood pressure is to high.
Please mark as brainliest
8 0
3 years ago
Other questions:
  • Which two editions of Windows 7 support 64 bit CPUs? Choose two out of Professional, Business, Starter, or Home Premium.
    12·1 answer
  • Which of the following tasks is least effective at preventing a computer virus?
    14·2 answers
  • The most common type of local correction system is
    11·1 answer
  • Which protocol is used by the client for microsoft networks and file and printer sharing for microsoft networks to communicate w
    10·1 answer
  • Which of these options would likely have a better playback experience in your presentation?
    8·2 answers
  • What were the goals of the “paperless society” ideal?
    14·2 answers
  • Where Can you find 2tickets Universal Studios Horror night
    10·2 answers
  • How would you convert an integer value to a float value in Python?
    10·1 answer
  • The CMOS battery located on a computer's motherboard allows for maintaining the correct time and date information stored in CMOS
    7·1 answer
  • Select the correct answer. Which is the bottom-most layer in the OSI model?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!