How's the output is 2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How's the output is 2

int a[3] = { 9, 3, 4 }; for (int i = 2; i > 0; i--) { a[0] -= a[i]; } cout << a[0];

9th Jan 2020, 7:13 AM
Ariz imam
Ariz imam - avatar
3 Answers
+ 1
thanks for helping me bro @swim
9th Jan 2020, 11:20 AM
Ariz imam
Ariz imam - avatar
0
the statement a[0] - =a[i] will be executed every time till the for loop run?
9th Jan 2020, 11:00 AM
Ariz imam
Ariz imam - avatar
0
Man i am so dumb I'm literally learning this sh*t from days.. yet can't figure it out..
9th Jan 2020, 11:19 AM
Ariz imam
Ariz imam - avatar