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

Design patterns, what is the use of design pattern in java ?

what is the use of design pattern in java ?

Explain what is local variable, Explain what is Local Variable ? Declar...

Explain what is Local Variable ? Declaring variables (using the var keyword) inside a function forms them local. They are available only inside the function and hold no meaning

Beam, program for hinged beam

program for hinged beam

Difference between inheritance and polymorphism, Question 1: a) What is...

Question 1: a) What is the meaning of an object-oriented programming? b) List eight simple types of data in Java c) Explain how objects and classes are closely related.

Develop android geolocation service app, Project Description: Develop an...

Project Description: Develop an android service app that will run on the background. The app has to get the users location (longitude and latitude) every 5 minutes or when th

Java script, var temp =14; var y = 2; temp document.write(temp);

var temp =14; var y = 2; temp document.write(temp);

What is the order of function invocation in an applet? , The Applet's life ...

The Applet's life cycle functions are as follows: public void init() : Initialization function called only once by the browser. public void start() : Method called after

What is preferred organizational structure for organization, What is the pr...

What is the preferred organizational structure for the organization? The Network Organization is becoming the preferred organizational structure.

Is jsp technology extensible?, YES. JSP technology is extensible by the dev...

YES. JSP technology is extensible by the development of custom actions, or tags, which are encapsulated in tag libraries. #question..

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