include using namespace std int main int sum 1 i0 for i0 i
#include using namespace std; int main() { int sum = 1, i=0; for (i=0; i
Solution
Answer:
the run 1, is the i
then sum is 2 because sum was 1 then it got increment when i was eequal to 0
so 1 + 1 =2
when i =3
sum = sum +i
sum was 2
so 2+3 = 5
when the loop will go i=5, sum we got =5 when i was 3.So, sum=5+5=10
the loop is until 6. So at the end of the loop, i =6 and then i got increment after the loop i++ thats why i=7.
