Predict the output of the given program ? #include<iostream> using namespace std; int main() { int m=7,k=3; k+=m++; m=++k; k=k++; m+=++k; cout<<m<<" "<<k; return 0; } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Predict the output of the given program ? #include<iostream> using namespace std; int main() { int m=7,k=3; k+=m++; m=++k; k=k++; m+=++k; cout<<m<<" "<<k; return 0; }

Challenging Game ;)

20th Aug 2016, 5:37 PM
Muhammed cp
Muhammed cp - avatar
10 Answers
+ 6
23 12
21st Aug 2016, 1:12 PM
Shree Ram
Shree Ram - avatar
+ 5
23 12
22nd Aug 2016, 5:12 AM
GTimo
GTimo - avatar
+ 4
23 12
20th Aug 2016, 9:48 PM
Asim
Asim - avatar
+ 4
23 12 Need to consider the pre and post increment
21st Aug 2016, 6:13 AM
Shiju T
Shiju T - avatar
+ 1
3 3 Assuming the variables start at 0, which they don't actually do in standard c++ 😜
20th Aug 2016, 6:08 PM
Jonathan Dirks
Jonathan Dirks - avatar
+ 1
4 3
20th Aug 2016, 6:37 PM
Sunil Kumar T
Sunil Kumar T - avatar
0
I think correct answer here
21st Aug 2016, 3:59 AM
Muhammed cp
Muhammed cp - avatar
0
23
23rd Aug 2016, 3:14 AM
The hacker
0
12
23rd Aug 2016, 3:14 AM
The hacker
0
+5
20th Mar 2018, 3:53 PM
immanuel pressy simbolon
immanuel pressy simbolon - avatar