Increment, Decrement Composite Operators Problem 1 – Computer Sir Ki Class
  

Login
[lwa]



Solved Problem! #CPP#1756 siteicon   siteicon   siteicon  

Problem Statement - Increment, Decrement Composite Operators Problem 1

Show the output of the following program –

TC++ #1756

#include<iostream.h>
int main()
{
int n=10;
cout<< n << endl ;
cout<< ++n << endl ;
cout<< n++ << endl ;
cout<< n << endl ;
cout<< - n << endl ;
cout<< - - n << endl ;
cout<< -- n << endl ;
cout<< n << endl ;
cout<< n-- << endl ;
cout<< n << endl ;
cout<< - --n <<endl;
cout<< (n+=1) <<endl;
cout<< (n-=1) <<endl;
cout<< (n%=2) <<endl;
return 0 ;
}

Test it !

Solution


Run Output

10
11
11
12
-12
12
11
11
11
10
-9
10
9
1


Share

CSKC| Created: 17-Dec-2017 | Updated: 18-Dec-2017|






Back