M
M
Muriam2019-02-10 11:20:39
Mathematics
Muriam, 2019-02-10 11:20:39

How to find the value of this mathematical expression?

For example, if N = 6
How to describe the arithmetic in detail?
see picture
5c5fded3a1120937496023.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir T, 2019-02-10
@Muriam

something like this:

int foo(int n)
{
int sign =1;
int sum = 0;
for(int i = 0; i <= n; i++)
{
  sum += sign * (2 * i + 1);
  sign *= -1;
}
return sum;
}

D
Denis Zagaevsky, 2019-02-10
@zagayevskiy

int f(int n){
   return 1 + n;
}

Do not thank.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question