+ 1
What is the output
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