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
valina [46]
2 years ago
6

JAVA

Computers and Technology
1 answer:
ryzh [129]2 years ago
7 0

import java.util.Scanner;

public class JavaApplication33 {

   public static void main(String args[]) {

     Scanner scan = new Scanner(System.in);

     int total = 0;

     System.out.println("Enter positive numbers (-1 to stop)");

     while (true){

         

         int num = scan.nextInt();

         if (num == -1){

             break;

         }

         else{

             total += num;

         }

     }

     System.out.println("Sum is "+total);

     

}

}

I hope this helps!

You might be interested in
Help please not trying to fail
deff fn [24]

Answer:

B. Everywhere CFCI is not

8 0
3 years ago
Can someone tell me what this means Higfaa
Arisa [49]

Answer:

it's a Jamaican slang

Explanation:

it depends on the wah it is used

7 0
2 years ago
_____ is a predefined format used for text the can include multiple font formatting features
seraphim [82]
The correct answer is



style
8 0
3 years ago
Create a game that rolls two dies (number from 1 to 6 on the side) sequentially for 10 times (use loop). If at least once out of
Alex73 [517]

Answer:

Explanation:

The following code is written in Java and loops through 10 times. Each time generating 2 random dice rolls. If the sum is 10 it breaks the loop and outputs a "You Win" statement. Otherwise, it outputs "You Lose"

import java.util.Random;

class Brainly {

   public static void main(String[] args) {

       UseRandom useRandom = new UseRandom();

       boolean youWin = false;

       for (int x = 0; x<10; x++) {

           int num1 = useRandom.getRandom(6);

           int num2 = useRandom.getRandom(6);

           if ((num1 + num2) == 10) {

               System.out.println("Number 1: " + num1);

               System.out.println("Number 2: " + num2);

               System.out.println("You Win");

               youWin = true;

               break;

           }

       }

       if (youWin == false) {

           System.out.println("You Lose");

       }

   }

}

class UseRandom{

   public int getRandom(int n)

   {

       Random r=new Random();

       int rand=r.nextInt(n);

       return rand;

   }}

8 0
2 years ago
What is the HTML tag used to define a block of content?<br> O <br> O class<br> O #id<br> O
allsm [11]
Are there any other options
7 0
2 years ago
Read 2 more answers
Other questions:
  • The act of engaging in crime through the use of a computer or similar type of device is called:
    8·1 answer
  • Word offers a multitude of picture formatting options that allow you to flip, rotate, and make many other adjustments to inserte
    15·1 answer
  • What are the 7 basic components found in a computer tower
    5·2 answers
  • Which part of the faucet is the aerator?
    13·1 answer
  • Explain what occurs when you synchronize computer and mobile devices.
    5·1 answer
  • Lydia noticed that she feels tired and out of breath after walking her dog up a hill in the park. Which area of fitness does she
    8·1 answer
  • For a wire with a circular cross section and a diameter = 3.00mm calculate the following: (m means meter. mm means millimeter. c
    5·1 answer
  • Brainliest to whoever answers this first, i need help explaining.
    8·1 answer
  • I love the brainly update guys! :)
    5·2 answers
  • What is the output for the following program?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!