menu
Qamnty
Login
Register
My account
Edit my Profile
Private messages
My favorites
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++; } els…
Ask a Question
Questions
Unanswered
Tags
Ask a Question
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++; } els…
asked
Nov 19, 2021
56.4k
views
3
votes
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 & Tech
high-school
Dlchet
asked
by
Dlchet
8.4k
points
answer
comment
share this
share
0 Comments
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
1
Answer
3
votes
Answer:
Move the duplicated code outside of the if statement
Zan RAKOTO
answered
Nov 24, 2021
by
Zan RAKOTO
8.5k
points
ask related question
comment
share this
0 Comments
Please
log in
or
register
to add a comment.
← Prev Question
Next Question →
Related questions
asked
Oct 16, 2021
167k
views
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
Vallentin
asked
Oct 16, 2021
by
Vallentin
7.4k
points
Computers & Tech
high-school
1
answer
0
votes
167k
views
asked
Jun 1, 2018
62.3k
views
What the output from the following code fragment: int t1 = 87; int t2 = 78; int larger; if( t1 > t2 ) larger = t1; else larger = t2; System.out.println( "larger: " + larger );
Dexters
asked
Jun 1, 2018
by
Dexters
8.1k
points
Computers & Tech
high-school
1
answer
0
votes
62.3k
views
asked
Nov 20, 2020
97.5k
views
What is printed out by the following code fragment? int n = 15; A) if ( 10 <= n && 20 <= n ) { System.out.println( "A" ); } else { System.out.println( "B" ); } B) if ( 10 < n || 20 < n ) { System.out.println( "C" ); } else { System.out.println( "D" ); } C) if ( n != 15 ) { System.out.println( "E" ); } else { System.out.println( "F" ); } D) if ( n == 15 ) { System.out.println( "G" ); } else { E) if ( n > 0 ) { System.out.println( "H" ); } }
Lexi
asked
Nov 20, 2020
by
Lexi
8.7k
points
Mathematics
high-school
1
answer
3
votes
97.5k
views
Ask a Question
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.
Categories
All categories
Mathematics
(3.7m)
History
(955k)
English
(903k)
Biology
(716k)
Chemistry
(440k)
Physics
(405k)
Social Studies
(564k)
Advanced Placement
(27.5k)
SAT
(19.1k)
Geography
(146k)
Health
(283k)
Arts
(107k)
Business
(468k)
Computers & Tech
(195k)
French
(33.9k)
German
(4.9k)
Spanish
(174k)
Medicine
(125k)
Law
(53.4k)
Engineering
(74.2k)
Other Questions
The book shows how to add and subtract binary and decimal numbers. However, other numbering systems are also very popular when dealing with computers. The octal (base 8) numbering system is one of these.
Seven basic internal components found in a computer tower
Please help me ! All you do is just put it it all in your own words ! Please this is for my reported card!i don't know how to put it in my own words because my English is not that good!
Twitter
WhatsApp
Facebook
Reddit
LinkedIn
Email
Link Copied!
Copy
Search Qamnty