+ 2
What will be the output and how it will be?
#include <iostream> using namespace std; int main() { int x,y,z; x=10; y=15; z=x+++y; cout<<x<<endl; cout<<y<<endl; cout<<z; return 0; }
3 Answers
+ 16
#include <iostream>
using namespace std;
int main() {
int x,y,z;
x=10;
y=15;
z=x+++y; // x = 11, y = 15, z = 11 + 15 = 25
cout<<x<<endl; // 11
cout<<y<<endl; // 15
cout<<z; // 25
return 0;
}
Output:
11
15
25
+ 4
Copy paste it in a compiler and you will know.
Even SoloLearn has one
+ 1
z=x+y.. then add 1 to x
so x=11, y=15, z=10+15=25