Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

difference between two expression given below

+4 votes
asked Sep 3, 2019 by operator
assume x=5,y=5;

x*=3+5;

y=y*3+5;

9 Answers

+3 votes
answered Sep 3, 2019 by anonymous
x*=3+5 will become x=x*(3+5) which will be x*8 = 40

where y=y*3+5 will be solved by BODMAS = 20
commented Sep 11, 2019 by ROSHINI18 (110 points)
distint and clear
0 votes
answered Sep 3, 2019 by remember me
for first expression is short end it can also written as x=x*(3+5)

for second it is multiplication  of   var y with 3 and then adding it to 5
+1 vote
answered Sep 3, 2019 by anonymous
Using order of Operator Precedence

x*=3+5        //x=5*(3+5)

y=y*3+5      //y=y*3+5

Answers = 40, 20
0 votes
answered Sep 10, 2019 by Shubham Pal (140 points)
both are same
0 votes
answered Sep 11, 2019 by anonymous
first one is x= x*(3+8);//x*=3+5 *= is compound operator

second one is y = y*3+5
0 votes
answered Sep 12, 2019 by Prakash Hadgal (180 points)
x*=3+5;      ==>    x = x*(3+5)    ==>   40

y=y*3+5;   ==>    y = (y*3)+5    ==>  20

Now you can see the exact difference.
+1 vote
answered Sep 18, 2019 by anonymous
*= is a compound operator

+, * , - , / are operators

x *= 3 + 5 can be written as x = x * (3 + 5).Here we need to consider BODMAS rule. So, output is  40

y = y * 3 + 5 ==> output is 20
0 votes
answered Sep 18, 2019 by vikash22kumar (200 points)
x*=(3+5)   x=x*(8)   x=40

y=y*3+5  y=15+5  y=20
0 votes
answered Sep 27, 2019 by anonymous
your first expression will be compiled as x=x*(3+5)

and your second one as  y=(y*3)+5
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...