If m = 5 and n = 2, predict the output values of m and n:
(a) m -= n;
(b) n = m + m/n;
213 Likes
m = 3n = 2
m -= n⇒ m = m - n⇒ m = 5 - 2⇒ m = 3Value of n is unchanged so it is 2.
m = 5n = 7
n = m + m/n;⇒ n = 5 + 5/2;⇒ n = 5 + 2; [∵ 5/2 is integer division so result is 2]⇒ n = 7Value of m is unchanged so it is 5.
Answered By
112 Likes
What will be the output of the variable 'a'?
int a=0,b=10,c=40; a = --b + c++ + b; System.out.println(" a = " + a);
What will be the output of the following if x = 5 initially?
(a) 5* ++x;
(b) 5* x++;