write a program that sum 1 to n code example
Example: 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;
}
int addNumbers(int n)
{
int count, sum = 0;
for(count=1; count <= n; count++)
{
sum = sum + count;
}
return sum;
}