Let solve the program using Java programming language
Method: method means group of statements to perform some operation.
let call the method sum.
Parameters: list of variables that are use in the method for declaration.
public int sum (int number)
if (number == 1)
answer = number;
int half = number/2;
int span = number - half;
answer = sum(half) + sum(span) + (half * span);
Firstly we defined the method called sum(), the method takes only one parameter which is number and return the answer(sum of the integers 1 and N).
if the number is equal to 1, so it will return the number and if the number is not equal to 1 it will divide the number by 2 and get the span(span used to shift upper range).And result will add sum of half, sum of span and product of half span.
When work is done on an object, energy is transferred. The rate at which this energy is transferred is called power. So the more powerful a device is, the more energy it will transfer each second. This is important when considering the total cost of electricity used as shown on an electricity bill.