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
NemiM [27]
3 years ago
6

Write a program that reads an integer and determines and prints whether it's odd or even. [Hint: Use the remainder operator (%).

An even number is a multiple of two. Any multiple of 2 leaves a remainder of zero when divided by 2.]
Computers and Technology
1 answer:
Sloan [31]3 years ago
4 0
<h2>Explanation:</h2>

The source code, written in Java, and a sample output have been attached to this response. It contains comments explaining certain parts of the code.

A few things to note are;

(i) The Scanner class is imported to allow user's interact with the program. This is done by writing the import statement at the top of the code as follows;

<em>import java.util.Scanner;</em>

<em />

(ii) An object of the Scanner class is created to receive inputs from the user. The object is called input and created as follows;

<em>Scanner input = new Scanner(System.in);</em>

(iii) Since the user is expected to enter an integer, the nextInt() method of the Scanner object is used to receive the integer and this is saved in a variable called <em>number. </em>i.e

<em>int number = input.nextInt();</em>

<em></em>

(iv) A number x, is even if its remainder when divided by 2 is 0. i.e

if x % 2 = 0, then x is even. Otherwise it is odd.

The user's input received and saved in a variable called <em>number </em>is then checked using if and else blocks to check if it is even or not and can be written as follows;

<em>if(number % 2 == 0){</em>

<em>    System.out.println(number + " is even");</em>

<em>}else {</em>

<em>    System.out.println(number + " is odd");</em>

<em>}</em>

You might be interested in
An attacker is preparing to perform what type of attack when the target vulnerabilities include headers and payloads of specific
kari74 [83]

An attacker is preparing to perform what Application attack  when the target vulnerabilities include headers and payloads of specific application protocols.

<h3>What Is an Application Attack?</h3>

An application attack is known to be a type of system attack which is made up of cyber criminals that is said to have access to any unauthorized points.

Note that this kind of Attackers are  the ones that start by  looking at the application layer, and then looking for any kind of application vulnerabilities that is found within the code.

Learn more about vulnerabilities from

brainly.com/question/25633298

3 0
2 years ago
Christina used the following expression to calculate the average ages of her three program users: average = age1 + age2 + age3 /
aleksley [76]
I am thinking it's A. Not so sure though.
6 0
3 years ago
Read 2 more answers
La energía se mide en:<br><br>A. ? julios<br>B. ? vatios<br>C. ? newton<br><br>​
joja [24]
La unidad de medida de energía oficial es el Joule (J). El kilovatio / hora (kWh), utilizado especialmente para la energía eléctrica, debe figurar entre las unidades más comunes de medición de energía (de hecho, se utiliza para calcular las facturas de electricidad). Entonces es B.
7 0
2 years ago
Read 2 more answers
Sharon is responsible for the security on web applications. She’s looking to see if all applications have input validation. What
LiRa [457]

Answer:

Options Include:

<em>A) Server-side validation </em>

<em>B) Client-side validation </em>

<em>C) Validate in trust </em>

D) Client-side and server-side validation

<em>Client-side and server-side validation is Correct</em>

Explanation:

The best option is to validate the client side with the server side. Using these together would provide the best testing option for Sharon.

<em>This keeps user feedback instantly without wasting postbacks while also protecting against JavaScript disabled users. That's how the validation controls for ASP.NET operate. </em>

This is definitely not over-engineering as there are risks of using one without the other.

Individual validation on the server side and individual validation on the client side are both incorrect. Trust validation is not a form of validation.

4 0
2 years ago
The physical view of a database system refers to
tigry1 [53]

Answer:

C. how and where the data are physically arranged and stored.

Explanation:

The physical view as the name implies describes how and where the data are physically arranged in the database. This deals with the physical arrangement of data in the database. This user usually view the database in a logical way. e.g table. The physical arrangement is usually used by database specialists. There can be multiple logical view of a database but just a single view of the physical view.

8 0
2 years ago
Other questions:
  • Go to the Creamy Ice Corporation passage on the next page. Insert the trademark sign after the word “Corporation'' in the first
    9·1 answer
  • Your mothers date of birth and a unique personal identification number (pin) code provide authentication by _____.
    15·1 answer
  • Your website is currently at position 5 in organic search. On a monthly basis you currently get on average 5,432 clicks and 32 c
    7·1 answer
  • 3. The invention of the transistor was important to the development of computers because it
    5·1 answer
  • Write a MARIE program to calculate some basic statistics on a list of positive numbers. The program will ask users to input the
    6·1 answer
  • Cheri needs to write a small program that interacts with the user. What step will allow her to do this?
    14·2 answers
  • Were does igneous rocks cool?
    9·1 answer
  • How do you award a brainliest
    8·2 answers
  • What should be a technicians first step in an A/C system
    7·1 answer
  • 3.2.3 What major al able to do? 3.2.4 What major advantage would Printer X have for Tembi who want documents printed? 3.3 If Tem
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!