What is output of the following c++ code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is output of the following c++ code?

#include<iostream> using namespace std; int main() { int a=5,b=10; int c=++a*b--; cout<<c*b; return 0; }

25th Nov 2016, 2:53 AM
Chaitanya
Chaitanya - avatar
3 Answers
+ 4
540 a became 6 thn multiplied with 10 gives 60 now value of b decreases and became 9 c=c*b = 60*9=540
25th Nov 2016, 3:43 AM
Dhruv Saxena
Dhruv Saxena - avatar
+ 2
Correct...
25th Nov 2016, 8:56 AM
Chaitanya
Chaitanya - avatar
+ 1
540
26th Nov 2016, 11:59 AM
Shubham Mittal
Shubham Mittal - avatar