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
I store data that the CPU needs. What am I?
Citrus2011 [14]

Answer:

Memory

Explanation:

Memory send commands to the CPU . Alternative modes of memory exist, and each one of them plays an essential role in operating a software machine.Memory is commonly called storage. Either the storage is unstable or non-volatile.

4 0
3 years ago
Read 2 more answers
Which of the following is used to store data in the computer's memory that can be
sasho [114]

The  storage that is used to store data in the computer's memory that can be used by a program later when executing instructions is variables.

<h3>What is variables?</h3>

Variables can be defined as the way or process in which data or information are store in a computer memory.

Data or information that may likely change or be altered are often stores in a computer memory storage called variables and this store data can be retrieve later for use by a program when executing instruction on the computer  system.

Inconclusion the  storage that is used to store data in the computer's memory that can be used by a program later when executing instructions is variables.

Learn more about variables here:brainly.com/question/23931018

5 0
2 years ago
Before becoming romantically involved with a coworker you should
astra-53 [7]
You should make sure no one is looking and make sure you have protection
7 0
3 years ago
Read 2 more answers
Meaning of fetch cycle​
kherson [118]

Answer:

The instruction cycle (also known as the fetch–decode–execute cycle, or simply the fetch-execute cycle) is the cycle that the central processing unit (CPU) follows from boot-up until the computer has shut down in order to process instructions.

Explanation:

7 0
3 years ago
How can you insert an image file in your word document?​
Margarita [4]

Click the insert tab, it'll show a pop up window. Go to the location of where your picture may be. Double click on the photo, and it will be inserted into the word document.

6 0
2 years ago
Other questions:
  • Suppose your company has decided that it needs to make certain busy servers faster. Processes in the workload spend 60% of their
    5·1 answer
  • Are commonly used to control the number of times that a loop iterates?
    5·1 answer
  • ServletConfig defines a set of methods that a servlet uses tocommunicate with its servlet container.
    5·1 answer
  • What soft ware can you use to erase all of your data from a hard drive safely
    13·1 answer
  • Produce definition in computer
    9·2 answers
  • A file name extension provides what information about a file?
    6·1 answer
  • On Edge; this assignment has been overdue for like three weeks because I DO NOT understand what to do, if you could help me that
    12·2 answers
  • What power points feature will you use to apply motion effects to different objects of a slide
    5·1 answer
  • The hostel in which you plan to spend the night tonight offers very interesting rates, as long as you do not arrive too late. Ho
    5·1 answer
  • Can someone help me with python
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!