#, 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:- #

Develop news feed android app design template, Project Description: You ...

Project Description: You should give A Working, Sample Android .apk Project and Java source code Original Photoshop PSD that I can edit and customize to fit my needs All S

Collaboration diagrams, Collaboration diagrams are also communication diagr...

Collaboration diagrams are also communication diagrams. Collaboration diagrams give the same message as the sequence diagrams. But the collaboration diagrams depend on the object f

Write a function that draws a cow , Write a function that draws a cow at a ...

Write a function that draws a cow at a certain location on the screen, and use the function to draw a herd of cows

Java program to play minesweeper , Project Requirements Write and tes...

Project Requirements Write and test a Java program to play Minesweeper using Model-View-Presenter design (The model is an interface defining the data to be displayed or other

Loop statements, A loop is a set of commands which executes repeatedly till...

A loop is a set of commands which executes repeatedly till a denoted condition is met. JavaScript supports two loop statements: for & while. Additionally, you can employ the break

Extraction of articles, Extraction of articles The software I'm looking ...

Extraction of articles The software I'm looking to build: 1. Extraction of articles from various sites 2. Format the content to re-post 3. Automate the process Skill

Image caching with html, In the airplane program, you may have noticed that...

In the airplane program, you may have noticed that the loading of each image appears to be jerky, erratic, or slow, and that the URL for each image flickers in the status bar each

Using the Case Study supplied, The report: Your report must describe the re...

The report: Your report must describe the requirements of the application, outline the design of the solution, and provide a testing procedure to prove the application works. In yo

What is render kit in jsf, Component classes generally move the task of gen...

Component classes generally move the task of generating output to the renderer. All JSF components follow it. Render kit is a set of related renderers. javax.faces.render.RenderKit

Describe member variables vs. local variables, Describe Member Variables vs...

Describe Member Variables vs. Local Variables ? class Car { String licensePlate = ""; // member variable double speed; = 0.0; // member variable double maxSp

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