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
Nimfa-mama [501]
2 years ago
7

Write a for loop that runs 5 times and accepts the input of an integer number every time. Those numbers will be accumulated by a

variable called total.
Computers and Technology
1 answer:
eduard2 years ago
7 0

Answer:

import java.util.Scanner;

public class num2 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int total = 0;

       for(int i=0; i<5; i++){

           System.out.println("Enter next Int: ");

           total = total+in.nextInt();

       }

       System.out.println(total);

   }

}

Explanation:

In the code above written in Java programming language, the for loop statement for(int i=0; i<5; i++) ensures that the loop goes from 0-4 a total of five times.

At each iteration it requests a user to enter an int. The number entered is stored in the variable total which is initially assigned 0.

When the loop finishes execution, total is printed out

You might be interested in
In matlab how would this specific code be written and how could I ask the user to enter a vector of coefficients for the polynom
solniwko [45]

Answer:

Explanation:

that is correct 1234

7 0
3 years ago
explain in detail how such a company can improve the focus and relationship with customers, and what they will benefit from this
Reil [10]
Advertisement maybe
6 0
3 years ago
When is the redo log buffer written to the redo log file?
natka813 [3]

Answer: B)The redo log buffer becomes one-third full.

Explanation:Redo log buffer is the type of buffer file that is present for storing the changes that have been done in data. Database changes are the made goes in the records of the redo entries.the change of the buffer to the redo files is done when the buffer contains change records which are full till the one-third section, thus conversion takes place from the redo buffer to the redo files.

5 0
2 years ago
Write a recursive method called repeat that accepts a string s and an integer n as parameters and that returns s concatenated to
svp [43]

Answer:

public static String repeat(String text, int repeatCount) {

   if(repeatCount < 0) {

       throw new IllegalArgumentException("repeat count should be either 0 or a positive value");

   }

   if(repeatCount == 0) {

       return "";

   } else {

       return text + repeat(text, repeatCount-1);

   }

}

Explanation:

Here repeatCount is an int value.

at first we will check if repeatCount is non negative number and if it is code will throw exception.

If the value is 0 then we will return ""

If the value is >0 then recursive function is called again untill the repeatCount value is 0.

6 0
2 years ago
Which save as element allows a user to save a presentation on a computer?
s344n2d4d5 [400]

Answer:

This PC

Explanation:

Got it right

7 0
3 years ago
Read 2 more answers
Other questions:
  • What does a transistor do?
    13·2 answers
  • Which of the following was one of the first internet search engines? A. archie B. google C. Yahoo D.ask
    7·1 answer
  • The methods of the Character class that begin with ____ return a character that has been converted to the stated format.
    5·1 answer
  • Create a pseudocode program that asks students to enter a word. Call a function to compute the different ways in which the lette
    9·1 answer
  • A technician is building a thick client workstation that would be used to run a database and wants to ensure the best protection
    12·1 answer
  • What's the difference between cross-site scripting and cross-site request forgery? How do you protect against cross-site request
    15·1 answer
  • Midday is a good time to take a portrait outside.<br> true or false?
    8·1 answer
  • Do you have any sprites for Friday Night Funkin?
    14·1 answer
  • true Or False 1. Computer Time is located in Start Menu, b. Ms Word is developed by Adobe Corporation c. Ms-Excel is Presentatio
    9·1 answer
  • Susan discovers the following log entries that occurred within seconds of each other in her Squert (a Sguil web interface) conso
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!