5-6. Write a code that, given an integer n, computes the sum
1 1 1 1 - + - + - + ... + - 1 2 3 nTrace your code for n = 3. Caution: What will happen if you write 1 / 2 in Java?
7. Trace, step-by-step, what will be the result of following Java code:
int n = 13;
String bin = "";
while(n > 0){
if (n % 2 == 1)
{bin = "1" + bin;}
else
{bin = "0" + bin;}
n = n / 2;
}
{System.out.println(bin);}
Draw the boxes corresponding to all the variables, and show all the changes of
their values.