Register now or log in to join your professional community.
The value of n after the execution is2. it iterates3 times while n decrements by1 and i increments by1 so when3 < =2 (i <=2) fails, loop fails and comes out of the for loop. Thanks.
Value of n will be2, since inside the loop value of n is decreasing and the loop will execute only till i<=n.
int n=5; for (int i=1,i<=5,i++)
{
cout<<"* n--<<
}
here the output sequence will be you will increment the value of i, till you try to come out of for loop and simultaneously decrement the value of n,
the end result will be4,3,2,1,0