Computer Applications
Evaluate the given expression when x = 4.
x *= --x + x-- + x;
Java Operators
7 Likes
Answer
x *= --x + x-- + x
x = x * (--x + x-- + x)
x = 4 * (--x + x-- + x)
x = 4 * (3 + x-- + x)
x = 4 * (3 + 3 + x)
x = 4 * (3 + 3 + 2)
x = 4 * 8
x = 32
Answered By
2 Likes
Related Questions
Consider the following program segment in which the statements are jumbled. Choose the correct order of the statements to return the sum of first 10 natural numbers.
for(i=1; i<=10; i++) → 1 return sum; → 2 int sum = 0, i; → 3 sum+=i; → 4- 1 2 3 4
- 3 4 1 2
- 1 4 2 3
- 3 1 4 2
Write Java expression for the following:
Convert the following switch case into if else if:
switch(x) { case 'T' : case 't' : System.out.print("Teacher"); break; default : System.out.print("Student"); }Write the output of the following program segment:
for(int a = 1; a <= 10; a++) { if(a % 2 == 0) continue; System.out.print(a + " "); }