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
Which is a feature of a strong thesis statement?
inessss [21]
A strong thesis statement should answer, but not elaborate on your opinion, or the facts of the central question.
6 0
3 years ago
What directs the read/write arm of the hard drive to where data exists and accesses it upon the user's request?
Nastasia [14]

Answer:

NTFS (New Technology File System) or FAT(File Allocation Table) are used to direct read/write arm of hard drive to where data exists and access it upon user's request

Explanation:

Both NTFS and FAT are used but NTFS is fast and optimal and superseed the FAT and supported by windows NT 3.1 and later versions.  

7 0
3 years ago
What are the 2 levels of formatting in a word document
goldfiish [28.3K]

Answer:

Paragraph Styles and character formatting (font, color, etc.)

7 0
2 years ago
What is the difference between computer architecture and computer organization?
alukav5142 [94]
The distinction between "computer architecture" and "computer organization" has become very fuzzy, if no completely confused or unusable. Computer architecture was essentially a contract with software stating unambiguously what the hardware does. The architecture was essentially a set of statements of the form "If you execute this instruction (or get an interrupt, etc.), then that is what happens. Computer organization, then, was a usually high-level description of the logic, memory, etc, used to implement that contract: These registers, those data paths, this connection to memory, etc. Programs written to run on a particular computer architecture should always run correctly on that architecture no matter what computer organization (implementation) is used. For example, both Intel and AMD processors have the same X86 architecture, but how the two companies implement that architecture (their computer organizations) is usually very different. The same programs run correctly on both, because the architecture is the same, but they may run at different speeds, because the organizations are different. Likewise, the many companies implementing MIPS, or ARM, or other processors are providing the same architecture - the same programs run correctly on all of them - but have very different high - level organizations inside them.
8 0
3 years ago
Read 2 more answers
Brad, a project manager, wants to build a database to integrate information about employees and tasks that they handle. Brad wan
zhuklara [117]

Answer:

entities

Explanation:

3 0
3 years ago
Other questions:
  • When a crystal grows in unrestricted space, how does growth occur?
    14·2 answers
  • In the spreadsheet example shown in chapter 5 ____ run from top bottom and are designated by a letter?
    12·2 answers
  • HELP! Answer to question 2?
    12·1 answer
  • Check My Work _____ are made in response to situations that have occurred frequently enough to enable managers to develop decisi
    15·1 answer
  • What effect on total current flow will a shorted series component have in a series-parallel circuit?
    8·1 answer
  • I need to change the subject before they get onto me. I am only revealing info today if you are a friend.
    5·1 answer
  • س2) اکتب خوارزميه لحل المعادلة الرياضيه الاتيه
    9·1 answer
  • Write a structured algorithm that prompts the
    9·1 answer
  • What happened to the ten commandments tablets.
    9·1 answer
  • The field of ____ is concerned with the technical issues involved in information display. computer science
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!