Online Compiler C

#include <stdio.h> int main() { int sum = 0; int number; // Loop through each number in the series for (number = 1; number <= 10; number++) { // Add the current number to the sum sum += number; } // Print the sum printf("The sum is: %d", sum); return 0; }
1) This code calculates the sum of all integers from 1 to 10 using a for loop.

2) Hint: The loop runs 10 times, with 'number' taking values from 1 to 10 sequentially.
Hint: The '+=' operator adds the current value of 'number' to 'sum' in each iteration.