Public class a {
public static int d(int n) {
int temp = n;
if (n == 1) {
Returns1;
}
if (n % 2 == 0) {
n =-n;
}
Returns n+d (temp-1); //This sentence is the key. It calls itself again. This is called recursion.
}
Public static void main(String[] args) {
system . out . println(a . d( 1 1));
}
}