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]
3 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]3 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
Write a C function (NOT A COMPLETE PROGRAM) which uses the RETURNstatement to calculate and return the total cost for purchasing
stira [4]

Answer:

int calculate_cost(int quantity) {

   double cost = 0;

   if (quantity <= 20)

       cost = quantity * 23.45;

   else if (quantity >= 21 && quantity <= 100)

       cost = quantity * 21.11;

   else if (quantity > 100)

       cost = quantity * 18.75;

   

   return cost;

}

Explanation:

Create a function called calculate_cost that takes one parameter, quantity

Initialize the cost as 0

Check the quantity using if else structure. Depending on the quantity passed, calculate the cost. For example, if the quantity is 10, the cost will be $234.5

Return the cost

3 0
3 years ago
Plz help i need a friends
Butoxors [25]

Answer:

i

Explanation:

3 0
2 years ago
Read 2 more answers
1.
Anna11 [10]
1. True
2. False
3. True


Have a great day <3
3 0
3 years ago
Look at (d), is it accurate? ​
Angelina_Jolie [31]

Answer:

ya

Explanation:

8 0
3 years ago
Read 2 more answers
5) How is the operating system on a desk top computer different from the operating system on a smart phone?​
lesya692 [45]
The difference is that system on a desk top preforms all the basic tasks like file management, memory management handling input and output and controlling peripheral devices such ad disk and printers where as some smart phone work on specific hardware
6 0
3 years ago
Other questions:
  • Consider the scenario below and determine the most likely source of the problem. A user reports that her or his printer is not r
    13·2 answers
  • Which option allows you to view slides on the full computer screen?
    11·1 answer
  • The expression 10,785(1.0275)x represents the amount of money in an investment account with interest that compounds annually for
    14·2 answers
  • Write a program in Python that reads in investment amount, annual interest rate, and number of years, and displays the future in
    6·1 answer
  • In a Java Script language. create a two-dimension array consisting of numbers representing costs. After creating the array, prin
    11·1 answer
  • Which 1898 film did George Melies create using camera trickery to create a illusion in which we now
    11·1 answer
  • Que es el sistema persona producto?​
    8·1 answer
  • Describe four traditional tehniques for collecting information during analysis.
    11·1 answer
  • What are the two compatibility issues that may arise between computer systems while transferring presentations? different video
    13·1 answer
  • persisting clumps of clippings can cause the turf below to yellow and possibly die. this phonomenon is called _________________
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!