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
sammy [17]
3 years ago
9

Analyze the following code (in both cases number has been declared and initialized): Code 1: boolean even; if (number % 2 == 0)

even = true; else even = false; Code 2: boolean even = (number % 2 == 0);
Computers and Technology
1 answer:
shusha [124]3 years ago
8 0

Answer:

Both codes are correct.The value of even is true when the number is even.

Explanation:

Code 1:

number %2 ==0 means that when dividing number by 2 is the remainder coming out is zero.If it is true then even becomes is true if it is false then else statement is executes in which even becomes false.Means the number is odd.This code is simple and easy to understand.

Code 2:-

This code is a bit tricky and takes time to understand.even becomes true

when the number is divisible by 0 and false when it is not.

You might be interested in
Why do you think LinkedIn has become so popular?
mart [117]
Because it is a liable source for business.
6 0
3 years ago
Write a HTML program as shown in the output.​
Vitek1552 [10]

Explanation:

<html>

<title>first term 9/<title>

<head>SUNGHAVA SHIKSHA NIKETANA</head>

<body>

<h1>maths formula</h1>

<h6>a2-b2=(a+b)(A-B)</h6>

<h1>list of exams<\h1>

<h6>1.computer,2.english,3science</h6>

</body>

</html>

3 0
3 years ago
What does SFA software provides tools for
solong [7]
They provide tools for sfa spftware
5 0
3 years ago
Read 2 more answers
Literacy is best defined as knowing how to: (Points : 1)
iragen [17]
Read and write. Think of the term "literacy rate" it refers to how much of a population can read and write.
5 0
3 years ago
Read 2 more answers
Has anyone used freya on Mobile legends bang bang
Vsevolod [243]
Yeaaaaahhh it’s so fun
4 0
3 years ago
Read 2 more answers
Other questions:
  • Opportunity cost is the least desirable alternative given up as a result of a decision.
    6·1 answer
  • Which pattern is produced by the following code? for (int i = 1; i &lt;= 6; i++) { for (int j = 6; j &gt;= 1; j--) System.out.pr
    6·1 answer
  • Which of the following is the main consideration when choosing an appropriate outlet box?
    7·2 answers
  • Digital printing is not suitable for printing what
    11·1 answer
  • Compute (110110001.01)2 + (27.12)10 + (121.25)16 – (130.20)16 and display the answer in hexadecimal base.
    7·1 answer
  • Study the sentences below. A.Changing the properties of characters in a sentence or paragraph in a Word document helps increase
    5·2 answers
  • 2. You have noticed over the past several days that your computer is running more slowly
    6·2 answers
  • What actions can you take to ensure the physical security of network devices?
    14·2 answers
  • Please what do you guys think about this ?
    10·2 answers
  • Do yall think I should be lonely and quit life!!
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!