0
How to solve a+++++a type questions
I couldn't able to solve these type questions and found some difficult
2 Réponses
+ 2
Let us consider a=5
a++ means value of a is increased by 1 but not displayed ( i.e. if you print 'a++', your output will be 5 not 6.
In case of ++a your output will be 6.
Came to your question:
(a++) + (++a)
i) output of a++ is 5 (but actual value=6 because it is increased by 1)
ii) now actual value of 'a' is 6, here a is increased by 1 again making the value 7 (++a)
Your ans= (a++) + (++a) =5 + 7 = 12.
Hope it helps.
0
Gajjala Venkata Sai Sri Harsha Hanumantha Rao the answer to this question will vary depending on the programming language used.
This expression will give an undefined result because the answer will be compiler dependent for programming languages like C and C++.
https://code.sololearn.com/cxi2Qy3mUGG7/?ref=app