Computer Science, asked by shardul1925, 1 year ago

I want the answer with full explanation :


•How the output will be 48??

Language:Java

50 point question.

Hoping for gud answer:(

Attachments:

Answers

Answered by pikachu90
1
please mark my answer as brainliest
Attachments:

shardul1925: but according to rule...12 should be multiplied naa
pikachu90: shorthand operator is like this which have used*=,+=,-=
shardul1925: ohb. thxx....
shardul1925: i got it...
pikachu90: you are using a*= if you would have used a=a*12 then multiplication would be done first
shardul1925: hmm.. i got it.
shardul1925: thxx. but now there is no option of brainliest..
pikachu90: after somebody else answer then you have the option of brainliest marking
shardul1925: yaa...i know..i will do it..and i have a more doubt can i ask
shardul1925: as the operand will be calculated at last so the value of a will not increase or what??
Answered by siddhartharao77
5

int a = 12, b = 8;

a*=(++a/6) + (b++%3);

(i)

(++a/6) + (b++%3);

= (13/6) + (8/3);

= 2 + 2

= 4.

(ii)

a* = (++a/6) + (b++%3)

a = a * [++a/6 + b++%3]

a = 12 * 4

a = 48.

Important points:

(i) % is called as modulo division. Remainder after division.

(ii) int is used to store whole numbers. In the above example, i have written 13/6 = 2. it should be 2.166667 but since the datatype is int, you cannot store 2.16667 in an integer, but you can in a float.

Hope it helps!

Similar questions