1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Mademuasel [1]
4 years ago
6

What is output by the following program? int i = 7; while (i>=2){System.out.print (i +""); if ((i%3) == 0){ i +2; } else { i/

=2;}}
Computers and Technology
1 answer:
stiks02 [169]4 years ago
6 0

Answer:

The correct answer to this question is: "this program give an error".

int i = 7; //declare a variable(i) and assign value.

while (i>=2) //use loop and check condition.i greater then equal to 2.

{

System.out.print (i +""); //print value of i.

if ((i%3) == 0) //hold remainder

{

i +2; //error.

}

else

{

i/=2; //hold Quotient

}

}

Explanation:

In the above program, there is an error in the if block because it is not the correct way to declare. To use the variable from the correct output we use a variable like this.

Example

int i = 7;

//declare a variable(i) and assign value.

while (i>=2)

//use loop and check condition.i greater then equal to 2.

{

System.out.print (i +""); //print value of i.

if ((i%3) == 0) //hold remainder

{

i =i+2;

}

else

{

i/=2; //hold Quotient

}

}

Output: 732

You might be interested in
Select the correct answer.
AveGali [126]

Answer:A

Explanation:

3 0
3 years ago
Read 2 more answers
What is the relationship between the binary number system and computer hardware?
lesya692 [45]

Answer: is the method of representing numbers that count by using combinations of only two numerals.

Explanation:

5 0
3 years ago
How should you behave in an online academic environment?
Kisachek [45]

Answer:

as u want lol

I think it's funny

8 0
3 years ago
Read 2 more answers
How does an ALU perform a logical operation? A. It compares two conditions. B. It compares two additions. C. It compares two mul
german
A.It compares two conditions
6 0
3 years ago
Read 2 more answers
A Python data model defining the state of a game for Tic-Tac-Toe. You must fully describe the notion of a state of the game, lim
Artist 52 [7]

Answer:

Check the explanation

Explanation:

Here in this game of Tic-Tac-Toe, it is using the TPGE engine which is a Tiny Python Game Engine. Let's talk about its functions like:-

def image_type(img): In this function, it is simply taking image as a parameter and returning its object type like DISC if the image is in graphical form, TEXT if it is a string, and LINE if it is other than the mentioned object.

def convert_image(img):  In this function, it is simply taking image as a parameter and returning an equivalent graphical object as understood by John Zelle's. Mainly comparing for three things in this function and those are: if image equals to DISC then it is calling convert_circle(function), if image equals to LINE then it is calling convert_line(function), and if image equals to TEXT then it is calling convert_text(function),

def convert_circle(x): This function takes a list( a group of values) and makes a circle at the center of the window and the circle's radius is coming from the list.

convert_text, convert_line, convert_circle are only creating text, line, and circle and then returning it.

def graphical_elements(images): This function is taking image as a parameter and then extracting shape and color from the image and then calling convert_image(shape) and convert_type(shape) and it gives us graphic and kind respectively. Now it is checking whether kind equals to DISC If yes then filling color on the window else, setting the outline of the window

def run(): Here it is finally running the game with required parameters, the whole game is continously running under the while loop.

That's all

8 0
4 years ago
Other questions:
  • The superintendent forbade the students to bring their books and copies in the exam hall. (into direct speech)​
    10·1 answer
  • An independent frame that holds a program, document, or folder contents in windows 7 is called a ____.
    11·1 answer
  • Which group on the Home Ribbon allows you to add shapes to a PowerPoint slide?
    10·2 answers
  • After class, Anita and Bev make plans to study for their psychology exam together but cannot decide on a time or location. In ad
    7·1 answer
  • What kind of security features does Microsoft Security Analyzer promise?
    5·1 answer
  • How to make all cells the same size in excel?
    15·1 answer
  • Calculate the data rate capacity for a 2400 baud signal where there are M=8 levels per symbol. a. 2400 bps b. 4800 bps c. 7200 b
    12·1 answer
  • An online bank wants you to create a program that shows prospective customers how their deposits will grow. Your program should
    13·1 answer
  • What is Ce stands for?
    8·1 answer
  • What would be printed to the screen when the following program is run?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!