#, JAVA Programming

Assignment Help:
Consider the following code? What input is needed for x in order for the sum variable that is output at the end of the code to be 12 ?

(In other words: what do I need to make X be in order for sum to be 12)

X is an int, so please keep answers to whole numbers.

Scanner s = new Scanner(System.in);
int sum = 0;
int y = 3;
int x = s.nextInt();
do{
x--;
if (x < 3)
continue;
sum += y;
}while (x > 0);
System.out.println(sum);

Related Discussions:- #

Explain the uses of JVM verifier, Explain the uses of JVM verifier The ...

Explain the uses of JVM verifier The JVM "verifier" checks the code when it's loaded to verify that it has the correct structure --that it does not use an uninitialized pointer

What is a portal?, A portal is a service or a Web site that gives broad ran...

A portal is a service or a Web site that gives broad range of services and resources like e-mail, forums, search engines, weather information, news, on-line shopping, stock quotes.

Java Gui, Does the java applet using swing components, JAVA Programming on ...

Does the java applet using swing components, JAVA Programming on this contain all the source codes for download?

Describe invoking methods in java, Describe Invoking Methods in java? c...

Describe Invoking Methods in java? class Car { String licensePlate = ""; // e.g. "New York 543 A23" double speed = 0.0; // in kilometers per hour double maxS

Want an expert with knowledge of uml diagrams, Want an expert with knowledg...

Want an expert with knowledge of UML diagrams and writing experience for pages writing including diagrams. This project needs 3-4 pages of technical writing about tickets reserv

Explain the rules for tostring() methods, Explain the Rules for toString() ...

Explain the Rules for toString() Methods ? toString() methods should return a single line of text that does not contain any carriage returns or linefeeds. toString() methods

Garbage collection in java, The Java programming language is object-oriente...

The Java programming language is object-oriented and includes automatic garbage collection. Garbage collection is the process of reclaiming memory taken up by unreferenced objects.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd