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
Stells [14]
3 years ago
15

Java

Computers and Technology
1 answer:
inna [77]3 years ago
3 0

Answer:

import java.util.Scanner;

public class num3 {

   public static void main(String[] args) {

     Scanner in = new Scanner(System.in);

       System.out.print("Enter two numbers: ");

       int num1 = in.nextInt();

       int num2 = in.nextInt();

       int sum = num1+num2;

       System.out.print("Do you want another operation: ");

       String ans = in.next();

       while(ans.equalsIgnoreCase("yes")){

           System.out.print("Enter two numbers:");

           num1= in.nextInt();

           num2 = in.nextInt();

           System.out.println("Do you want another operation: ");

           ans = in.next();

           sum = sum+(num1+num2);

       }

       System.out.println("sum = "+sum);

   }

}

Explanation:

In the program written in Java Programming language,

The scanner class is used to prompt and receive two numbers from the user which are stored as num1 and num2. Another variable sum is created to hold the sum of this numbers

Then the user is prompted to answer yes or no using Java's equal.IgnoreCase() method.

If the user enters yes, he/she is allowed to entered two more numbers that are countinually added to sum

If the user eventually enters a string that is not equal to yes. The loop terminates and the accumulated value of sum is printed.

You might be interested in
Which part of color theory deals with how colors on a web page relate to each other?
Elena L [17]

Answer:

C) Matching

Explanation:

5 0
4 years ago
Read 2 more answers
A total stranger is trolling Jack online. He’s offended and annoyed. How can Jack stop the troll in his or her tracks? (5 points
zvonat [6]

Answer:

log off the web page would be the best answer here or explaining why trolling is rude but log off the web page is the best one here

5 0
3 years ago
Read 2 more answers
Electronic files created on a computer using programs such as word software are considered to be
nika2105 [10]

From the Page Layout tab, click Margins. Select Custom Margins... from the drop-down menu. Selecting Custom Margins...

The Page Setup dialog box will appear.

Adjust the values for each margin, then click OK. The Page Setup dialog box.

The margins of the document will be changed

6 0
4 years ago
Vector images take up much less space when saved to a computer or storage device because computers and storage devices just need
AleksandrR [38]

Answer:

False

Explanation:

4 0
2 years ago
Read 2 more answers
What is the maximum length of a text field can be?<br>​
Luda [366]

Answer:

4000 characters

Explanation:

I think the max is 4000 characters

7 0
2 years ago
Read 2 more answers
Other questions:
  • Software that people commonly use in the workplace to make their lives easier is called
    15·1 answer
  • The picture that graphically represents the items you use in Windows is called a/an
    15·1 answer
  • Programmers compile a list of instructions to build their applications. These instructions are typically grouped into units of c
    10·1 answer
  • . Convert BAC4 from hexadecimal to decimal. Show your work.
    9·1 answer
  • Which results are expected in a personality test but not a skills assessment?
    13·1 answer
  • The National Vulnerability Database (NVD) is responsible for actively performing vulnerability testing for every company's softw
    8·1 answer
  • Some people worry that there won’t be enough jobs in the future because computers will be able to do everything better than peop
    7·2 answers
  • Pls answer dis question when i'm not connected and i open bluestacks 5 it will be working but if i am connected it wil not work
    14·1 answer
  • Write a function float Average(int, int) that finds the mean, and then write a main program that inputs two numbers from the use
    7·1 answer
  • When an item in a menu is black, it means that _____.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!