Answer:
Correct code is:
int sum;
for (int i=0; i<1000; ++i)
sum += i;
printf("Sum of 0 to 999 is %d\n", sum);
Explanation:
In the problem code there is a open curly open bracket after the sum+=1;.
This open bracket will give an To fix this code, we remove this bracket from the given code.Then this code will calculate sum of all number from 0 to 999.And the last line of the code will print the sum.