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

Ajax- html- xml- css and tomcat used in java, AJAX- HTML- XML- CSS and  To...

AJAX- HTML- XML- CSS and  Tomcat used in Java: Project Title: Zee Ads   Role                       : Developer Domain                  : Web Ads Environment

Write a java program to take data from excel files, Java program will be ta...

Java program will be take data from excel files (left diagram), and uses can be able to enter the input(middle diagram) in website when run the input the result appear in Pie 2D or

Pogram must work on all realms and all ladders, Project Description: The...

Project Description: The program must work on all realms, all ladders, all cores (4x realms,2x ladders,2x cores) The program must be unpatchable and undetectable If patche

Demonstrate your ability to ability to use java data , Purpose Demonstr...

Purpose Demonstrate your ability to ability to use Java data and control structures. Draw with the aid of conditionals and loops. Background Thought A note on comments:

Use the constructor, Can we use the constructor, instead of init(), to init...

Can we use the constructor, instead of init(), to initialize servlet? Ans) Yes. Of course you can use the constructor instead of init(). There's nothing to stop you. But you sho

Describe the superclass in inheritance, Describe the Superclass in Inherita...

Describe the Superclass in Inheritance ? In this example you start through defining a more common MotorVehicle class. public class MotorVehicle { private String licensePlat

Luminus jewels, Luminous Jewels - The Polishing Game Byteland county is ve...

Luminous Jewels - The Polishing Game Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various lum

What do you understand by private and public class, What do you understand ...

What do you understand by private, protected and public? These are accessibility modifiers. Private is the most restrictive, whereas public is the least restrictive. There is n

Explain vector or object-oriented graphics, Explain Vector or Object-Orient...

Explain Vector or Object-Oriented Graphics? The representation of graphical objects, like as lines, circles, arcs, and rectangles, along with mathematical formulas. This techni

Life span of variables, While you declare a variable in a function, the var...

While you declare a variable in a function, the variable can be accessed within that function only.  While you exit the function, the variable is destroyed.  These variables are ca

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