+ 2
This is a challeng question
int a=0; for(int i=0;i<=2;i++) a=a+i; cout <<a%2; I did not understand the concept of for loop please any one help me and i am not understanding how to solve it
6 Respostas
+ 2
First, a is initialized to 0, and the loop make i added to a 3 times, which are 0, 1, 2. 0(a)+0+1+2=3. 3%2==1.
+ 2
Thank you AteFish
+ 1
Your code will make compile errors. These are missing ; and Capital Cout. And if you resolve the compile error, it will introduce an infinite loop because i=2 always returns true.
+ 1
Carrie Forle thankyou for giving reply and sorry for making mistakes here again i edited it once please check it
+ 1
Thank you a lot carrieForle