sum in c code example
Example 1: c defined value sum
#define VALUE_A 2
#define VALUE_B 2
#define SUM_A_B (VALUE_A + VALUE_B)
Example 2: sum of n natural numbers in c
int addNumbers(int n)
{
int count, sum = 0;
for(count=1; count <= n; count++)
{
sum = sum + count;
}
return sum;
}