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
NeX [460]
3 years ago
11

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++; } Move the duplicated code outside of the if statement Shorten variable names Move the brackets to save several lines of code Add semicolons after the if condition and the else reserved word
Computers and Technology
1 answer:
meriva3 years ago
5 0

Answer:

Move the duplicated code outside of the if statement

You might be interested in
In mathematics, the notation n! represents the factorial of the nonnegative integer n. The factorial of n is the product of all
hram777 [196]

Answer:

The program to this question can be given as:

Program:

factorial=1 #declare a variable.  

number=int(input("Enter a positive integer:")) #input a number.  

while (number>0): #loop  

   factorial= factorial*number # holding value in factorial variable  

   number=number-1  

print('=',factorial) #print value.

Output:

Enter a positive integer:6  

= 720  

Explanation:

The description of the above python program can be given as:

  • In the above program firstly we define a variable that is "factorial". In this variable, we assign a value that is 1 and it is used to calculate the factorial value.  
  • We define a variable "number". The number variable is used to take input from the user.  
  • Then we define a loop in the loop we calculate the factorial and hold the value in the factorial value in the last we print the value.  

4 0
3 years ago
A set of well-defined steps for performing a task or solving a problem is known as a(n):A) HierarchyB) AlgorithmC) Central Proce
RideAnS [48]

Answer:

The correct answer to the following question will be Option B (Algorithm).

Explanation:

  • An algorithm seems to be a countable series of very well-defined, machine guidance that is implementable, and are generally used to solve a group of issues and to perform a calculation.
  • It is widely used for processing of the data, computation and other associated computational and numerical activities.
  • A coding algorithm is a process of the computer that's a lot like just a formula that tells the machine precisely what actions you need to follow to fix a problem or achieve a goal. 

The other three options will not be able to fix the problems that arise while achieving a goal, execution of a function or creating program code.

Therefore, Option B is the right answer.

5 0
3 years ago
What amount of memory enough to store alatter of the alphabet or store a small number​
laiz [17]

Answer:

It can be "ON" or "OFF". So it can store the numbers 1 and 0, but it certainly doesn't have the capacity to store a letter of the alphabet.

Explanation:

3 0
2 years ago
Rita used information from a blog that someone else wrote. What should she do?
Shkiper50 [21]

Answer:

rita should either ask the original author for permission to use her blog, but the best answer woyuld be that she should site her sources.

Explanation:

7 0
3 years ago
When you adopt a certain framework or strategy for solving a series of problems, you may fail to see other, more efficient ways
Olegator [25]
I believe it is called closed mindset. Closed mindset is when you fail to see other ways to your error and don't accept help or think you can improve.
7 0
4 years ago
Other questions:
  • WILL GIVE BRAINLIEST! A rent payment is an example of which type of expense?
    14·2 answers
  • Five computers are connected to a switch in a star topology. what type of network is this?
    12·1 answer
  • What is the term used to describe data sets are so large and complex that they become difficult to process using traditional dat
    12·1 answer
  • What is another term for technology?
    12·1 answer
  • Pick 2 different operating systems and discuss how they can be used in daily operations.
    5·1 answer
  • A ____ typically rests on the desk or other flat surface close to the user’s computer, and it is moved across the surface with
    13·1 answer
  • The two major types of system software programs are utility programs and the ________. Select one: A. user interface B. supervis
    13·1 answer
  • What is digital scavenger hunting? A. An application that locates addresses B. A scavenger hunt where players use GPS and digita
    5·1 answer
  • What caused accident? into passive voice​
    13·1 answer
  • Im timed!!!!!!!!!!!!!!!!!!<br><br> I NEED HELP ASAP<br> THANK YOU SO MUCH
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!