Computer Science, asked by poojapansare, 10 hours ago

What should be the output of below program?

int main()

{

int a=10; 

cout<<a++;

return 0;

}​

Answers

Answered by Oreki
6

\textsf{\large Given Snippet}

   \texttt{int main() \{}\\\texttt{\hspace{1em} int a = 10;}\\\texttt{\hspace{1em} cout &lt;&lt; a++;}\\\texttt{\hspace{1em} return 0;}\\\texttt{\}}

\textsf{\large Ou\symbol{116}put}

   \texttt{10}

Answered by monica789412
4

The mentioned programming lines are in C plus plus programming language so the output of the mentioned segment of the program is '10'.

Detailed Explanation:

  • The variable 'a' is declared as the integer data type and its assigned value is 10.
  • But before the value is increased by 1, the initial value  is displayed because the operator which is used here is postfix increment operator.
  • The value is displayed in the first place by using the postfix increment operator  which means the  initial value of the variable 'a' is displayed first and then the given variable which is 'a' is increased by 1.

OUTPUT:

10

Similar questions