Sum a line of numbers **programming exercise**.

*The dragons of Shan mountain have to do math again. But since the math is not with gold coins, they became bored and offered the following quest:*

Given **two integers** find the **sum **of all the numbers **between** *including them.*

Assume that the integers are not always in **ascending order**. And also – could be **negative**.

Example 1:1 5So we need all the numbers between12 3 45. 1+2+3+4+5=15Example 2:4 -3Or the number-3-2 -1 0 1 2 34

For the solution of this **coding problem** kindly scroll down.

public static int GetSum(int a, int b) {//first lets start with our variable(spaceinmemory) //Since all variables are space in memory, they have to //have .. well space! But how much space ? //that's what types are. Do you know how much spaceINTis? //And don't answer something like: "depend on the hard disk"int sum = 0;//lets create the numbers with for loop and sum them //we have to determine the proper start and end of the loopif (a>b) { for (int i = b; i <= a; i++) {sum += i;} } else { for (int i = a; i <= b; i++) {sum += i;} }//returning the resultreturn sum; }