Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int x = 5, y = 5, z;
6.
x = ++x; y = --y;
7.
z = x + ++x;
8.
cout
Options:
A .  11
B .  12
C .  13
D .  14
Answer: Option D

In this program, we are adding the x value after preincrementing two times.
Output:
$ g++ incre4.cpp
$ a.out
14



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers