12th Dec 2018, 2:04 PM
cristhian elvis velasquez ventura
cristhian elvis velasquez ventura - avatar
2 Antworten
+ 8
int main() { int sum=0; for(int i=0;i<2;i++); // <=== { sum+=1; } cout<<sum; return 0; } Note that there is a ' ; ' after for loop Hence the for loop iterates without executing block of code Hence after for loop completes iterations it executes sum+=1 Hence sum is 1
12th Dec 2018, 2:15 PM
Rstar
Rstar - avatar