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
What is the top anime shows? <3
LenKa [72]

Answer:

This is personally based on my opinion.

My top 10 favorites

Toradora

Darling in the franxx

Lucky Star

My Melody

Death note

Attack on titans

One piece

The Promise neverland

Kaguya-sama: love is war

Black cover

4 0
3 years ago
Read 2 more answers
How would you log in as zach if you did not know his password but knew the root password?
Nuetrik [128]
You can login in root terminal and then type #sudo Zach 
8 0
3 years ago
What is the answer ?? plz help
Morgarella [4.7K]
3rd: A force applied to a body to propel it in a desired direction.
5 0
3 years ago
Ann, a user, wants to host a gaming server on her SOHO network. Which of the following features on the SOHO router would need to
Nat2105 [25]

Answer:

The answer is C. Port forwarding

Explanation:

In computer networking, port forwarding or port mapping is an application of network address translation (NAT) that redirects a communication request from one address and port number combination to another while the packets are traversing a network gateway, such as a router or firewall. This technique is most commonly used to make services on a host residing on a protected or masqueraded (internal) network available to hosts on the opposite side of the gateway (external network), by remapping the destination IP address and port number of the communication to an internal host

7 0
3 years ago
Identify the three main parts of a professional cover letter
umka21 [38]

Three main parts of a professional cover letter: Heading, body, closing and signature line. I hope this helps! :)

4 0
3 years ago
Read 2 more answers
Other questions:
  • At the dsl local carrier's office, the __________ demultiplexes the data streams and converts them into digital data.
    10·1 answer
  • Which would take more storage space, a layer file showing all the us counties or a layer file showing all the us states?
    8·1 answer
  • Write a program that prompts the user to enter the year and the first three letters of a month name (with the first letter in up
    8·1 answer
  • Which of the following would be a valid method call for the following method? public static void showProduct (int num1, double n
    6·1 answer
  • Suppose that the format for license plates in a certain state is two letters followed by four numbers. (a) How many different pl
    6·1 answer
  • Type the correct answer in the box.
    5·1 answer
  • A customer would like you to install a high-end video card suitable for gaming. Your installation and configuration SHOULD inclu
    7·1 answer
  • How many clients has<br> Accenture engaged globally on blockchain?
    12·1 answer
  • A serial schedule:
    8·1 answer
  • This might sound crazy! But please help.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!