# Example 6

Calculate sum of numbers present between 1 and 200.

int sum = 0;
for (int i = 1; i <= 200; i++)
{
  sum += i;
}
Console.WriteLine(sum);
1
2
3
4
5
6

If you are confused about += operator then please refer to Compound Assignment.

Last Updated: Apr 22, 2020, 5:33 PM