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
Arlecino [84]
3 years ago
15

Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive.

After the loop terminates, it prints out, on a line by itself, the sum of all the even integers read. Declare any variables that are needed. ASSUME the availability of a variable, stdin, that references a Scanner object associated with standard input
Computers and Technology
1 answer:
kolbaska11 [484]3 years ago
6 0

Answer:

Written in Java Programming Language

import java.util.Scanner;

public class Assign{

   public static void main(String [] args)    {

   Scanner stdin = new Scanner(System.in);

   int num,sum=0;

   System.out.println("Start Inputs: ");

   num = stdin.nextInt();

   while (num>=0) {

       if(num%2== 0)

       {

       sum+=num;    

       }      

       num = stdin.nextInt();

   }

   System.out.print("Sum of even numbers: "+sum);

   

   }

}

Explanation:

I'll start my explanation from line 4

This line initializes Scanner object stdin

Scanner stdin = new Scanner(System.in);

This line declares necessary variables and initializes sum to 0

   int num,sum=0;

This line prompts user for inputs

   System.out.println("Start Inputs: ");

This line reads user inputs

   num = stdin.nextInt();

This line checks is user input is not negative (It's a loop that will be repeated continually until a negative number is inputted)

   while (num>=0) {

This line checks if user input is an even number

       if(num%2== 0)

       {

If the above condition is true, this line calculates the sum of even numbers

       sum+=num;    

       }      

This line prepares the user for next input

       num = stdin.nextInt();

   }

This line prints the calculated sum of even number; If no even number is inputted, the sum will be 0

   System.out.print("Sum of even numbers: "+sum);

You might be interested in
When organizations record versions of their policy in English and alternate languages, they are attempting to meet the ____ crit
Jobisdone [24]

Answer:

C. Review.

Explanation:

Company policy are rules and regulations constructed by a legal team of a company that must be adhere to by all employees and users of the company's services.

There are five requirements for a policy to become enforceable. They are, dissemination, review, comprehension,compliance and uniform enforcement.

Dissemination has to do with the communication of the policy for review. Review is the process that creates alternative language copies of the policy for non English speakers. Compliance is the confirmation of agreement by the employees and comprehension verifies that the policies are understood. Uniform enforcement is a confirmation that the policy has been uniformly enforced on all in the company.

6 0
4 years ago
This schematic of a new invention was submitted to the US
DanielleElmas [232]

Answer:

I don’t the answer

Explanation:

I don’t like the government

5 0
3 years ago
What are some of the shortcomings of antivirus software today?
geniusboy [140]

Answer:

The answer is below

Explanation:

There are various shortcomings of antivirus software today, some of which are:

1.  Endless Upgrade system: today's antivirus requires users to upgrade every now and then,

2.  Excessive Ads: there are too much and unnecessary advertisements on the software

3.  It takes a longer time to perform scans.

4.  Some antivirus shares users' computer usage data online, which can be considered as an invasion of privacy.

5.  Some lack superior scanning operation.

3 0
4 years ago
1. ¿Qué otros tipo de pensamientos apoyan al pensamiento computacional?
Anni [7]

Answer:

1. What other kinds of thoughts support computational thinking?  

Some additional types of thoughts that are in streak with computational thinking are from the arena of humanities, mathematics and science such as systems thinking, scientific as well as model-based thinking, engineering thinking, and design thinking. For confirming this, we necessitate to recognize the computation thinking, which is the procedure for problem-solving, that asylums plentiful features as well as outlooks. And CT is significant for the expansion of computer applications, and as elucidated overhead it is cast-off to resolve from numerous turfs and topics.

3. Who was the pioneer in the incorporation of programming languages? Why and how was it put into circulation?  

Plankalkul, and Konrad Zuse put frontward the Z3 in amid the time 1943 and 1945. Though, this was not being applied till the year 1998, the shortcaode, which was actuality put forward by the John Mauchty, and which is regarded as the first high level programming language in the year 1949. And, it was none other than Grace Hopper who proposed the first high-level language that was not dependent on machine, and that led to the development of COBOL.  And computational thinking is implemented since it provides the right results for almost all the real-world problems. And a habit is being generated to break down a big problem into a finite set of smaller modules, then model them into flow charts, and grasp how to act sequentially to come up with the answers. The technique is quite extremely successful in sorting out almost all the real-world issues.

4. Who recently defined it and how-to computational thinking?

Wing (2006,2011) came up with computational thinking description, as a technique of intelligence that includes the devising of snags as well as their answers which are characterized in the arrangement which can be efficiently be handled through the computer. Previous, It was Seymour Papert who is supposed to be the initial for using computational thinking. He was a mathematician as well as recognized as the co-founder of the AI at MIT.

5. What steps are taken into account to decompose a problem?

The multifaceted problems or the organizations can be disintegrated into numerous minor parts, which are effortlessly controllable as well as fairly calm to recognize. Also, the slighter part is then reviewed as well as independently premeditated. Subsequently they are easy to labor upon.

Explanation:

Please check the answer section.

7 0
3 years ago
How do you identify certain input answers in python?
Papessa [141]
If you would like to check the value on an input, you will have to handle the ValueError that may occur if you try to convert the input.

- If you want the input to be a string, then that's simple, because input is already a string :)

- If you want the input to be an integer, a float, or whatever else, of course you would have to convert your string input to whatever you require. For example:

If you try
age = int(input('Enter your age: '))
And the user enters something like 5, then that's fine and will convert no problem.
However, if you tried to enter 1.5, or 'hello' or something that is NOT an integer, you will notice it generates something called a "ValueError", and the program will cease to parse.
This is what I mean by handling the error. We make our program 'handle' the error and do something else if it occurs, so that it doesn't crash our program and it can continue parsing.
This can be done by using the keywords "try" and "except"

try is a block of code that you expect an error (called an exception in other languages, hence the keyword "except"), and the except catches certain type of errors. In the exam below, we have a loop that continuously asks the user for their age until the value is valid:

<span>age = <span>None
</span>while not isinstance(age, int):
    try:
        age = int(input('Enter your age: '))
        if age < 0:
            raise <span>ValueError
</span>    except ValueError:
        print('That is not a valid age.')
</span>
Let me know if you have any questions :)

 
5 0
4 years ago
Other questions:
  • Which tools can be used to scale an object? Check all that apply.
    6·1 answer
  • Are microsoft critical updates important
    9·1 answer
  • A ____ is a collection of computers and users that are identified by a common security database. workgroup controller segment do
    7·1 answer
  • Which file extension indicates the file is a Microsoft Word document?
    11·1 answer
  • Select all reasons it is important to perform equipment maintenance
    8·1 answer
  • In 5-10 sentences, describe how computer networks work.
    6·1 answer
  • Imagine you want to clean up your database and decide to delete all records from the Review table that have an Id of 100 or less
    14·1 answer
  • Write a java program to create and display unique three digit number using 1,2,3 and 4 also count how many three digit number ar
    10·1 answer
  • A list is sorted by selecting the largest element in the list and swapping it with the last one. This technique is called ______
    7·1 answer
  • Cultural differences may make it difficult for team members to _____. Select 4 options.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!