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
kotegsom [21]
3 years ago
13

What is the best way to improve the following code fragment? if ((counter % 10) == 0) { System.out.println("Counter is divisible

by ten: " + counter); counter++; } else { System.out.println("Counter is not divisible by ten: " + counter); counter++; }
Computers and Technology
1 answer:
Nataly_w [17]3 years ago
6 0

Answer:

The correct code to the given question is

if ((counter % 10) == 0)  // check the condition

{

System.out.println("Counter is divisible by ten: " + counter);  // display

}

else  // check the condition

{

System.out.println("Counter is not divisible by ten: "  +counter); // display the //value

}

counter++; // increment the value of counter

Explanation:

Following are the description of code

  • In the given question we have to check the condition that the given number is divisible by 10 or not .
  • In the if block if the number is divisible by 10 then it print the value of number and increment the value of counter .
  • In the else block if the number is not divisible by 10 then it print the value of number and increment the value of counter .
  • It means the value of counter is increases in the if block as well as in the else block .So we have to remove the counter statement from there and place outside the if and else block .

You might be interested in
...............is a personal computer that fits on desk.​
vesna_86 [32]

Answer:

desktop computer

Explanation:

8 0
3 years ago
Read 2 more answers
What is a interesting topic that is related in media and culture
kotykmax [81]

how to protect the culture.


8 0
3 years ago
Read 2 more answers
Match the installation type to its description.
MariettaO [177]

Answer:

Following are the types of installation matched to its respective definitions.

<h3>Upgrade installation:</h3>

What you do when you have a computer with an existing operating system that needs to be upgraded.

This means that while working on a window when you get attracted by the update introduced recently and you upgrade your window accordingly.

For example: Updating a window from 8 to 10 or desired features.

<h3>Multiple boot installation:</h3>

What you do when you have several operating systems on one computer.

In this type of installation, a computer has different windows for different accounts. You can boot to the desired installed window by switching account.

<h3>Clean installation:</h3>

What you do on a brand new computer that has never been set up before and does not have an operating system on it yet.

It can be defined as the installation of window done very first time on to the computer. Sometimes when the window gets deleted due to virus or any other factor, the installation at that time will also be termed as Clean Installation.

<h2>I hope it will help you!</h2>
5 0
3 years ago
Can someone help me find all the solutions to the problem ​
zepelin [54]
Answer this with the dots connected. Why is it. You may ask? I bet it’s 40
7 0
3 years ago
Read 2 more answers
What is a lease? AA contract outlining the terms of a mortgage. BA contract outlining the terms under which a landlord agrees to
Lesechka [4]

B. A contract outlining the terms under which a landlord agrees to rent property to a tenant.   
A lease is where you arrange to use someone else's property, generally in exchange for money. The ownership of the property remains with the other entity. So with that in mind, let's look at the options.  
A. A contract outlining the terms of a mortgage.  
* This is a contract arranging for the transfer of ownership of property from one entity to another. So this is not a lease and is a bad choice.  
B. A contract outlining the terms under which a landlord agrees to rent property to a tenant.  
* This does meet the definition of a lease. You rent and therefore use someone else's property, but the ownership of the property remains with the landlord. So this is the correct choice.  
C. A loan from a bank used to rent a home. 
 * This does not meet the definition of a lease and is therefore a bad choice. 
 D. A loan from a bank used to buy a house. 
* This also does not meet the definition of a lease and is therefore a bad choice.
5 0
3 years ago
Other questions:
  • Hardware- The ______________ equipment that makes up the computer.
    6·1 answer
  • How do rubrics increase learning?
    15·2 answers
  • What characteristics need to be exhibited by an organisation to improve its software process?
    7·1 answer
  • What is an individual piece of data called in a database? coding A field B file C record or D tittle
    9·1 answer
  • If you witness physical bullying and want to help, what should you consider first?
    5·1 answer
  • 1. Do you consider Facebook, MySpace, and LinkedIn forms of disruptive or sustaining technology? Why?
    15·1 answer
  • What is the keyboard shortcut to display the merge to printer dialog box?
    5·1 answer
  • The find and
    10·1 answer
  • Generally speaking, problems are rarely caused by motherboards. However, there are some instances in which a motherboard can fai
    12·1 answer
  • Ergonomics implications of computer​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!