191k views
0 votes
Write a statement that uses the decrement operator, in prefix mode, to decrease the value of the variable time.

1 Answer

5 votes

Answer:

public class Main

{

public static void main(String[] args) {

int time = 60;

--time;

System.out.println(time);

}

}

Step-by-step explanation:

*The code is in Java.

Initialize an integer called time and set it to some value, in this case 60

To use the decrement operator in prefix mode, you need to write the decrement operator, --, before the variable time. The decrement operator decreases the variable value by one first and then gives back the new value. In our example the output will be 59.

User Shanikqua
by
5.2k points