how i use function in c programing sum of the series
1+2+...+n
Last edited on
Depends on the series. If it's just adding 1 until you reach n then:
1 2 3
|
int a = 0;
for (int i = 0; i <= n; i++)
a += i;
|
EDIT: (wrong equation!)
Last edited on
Faisal440 wrote: |
---|
1+2+...+n |
is an
arithmetic series. The sum of arithmetic series has an
analytic solution. A simple equation.
Topic archived. No new replies allowed.