# Answer to Question #66133 in Java | JSP | JSF for David

Question #66133

4.Assign to the variable sum the value of the algebraic expression below. Be careful to follow the order of operations! Assume sum and num are integers.

num (num + 1)

sum = ------------------

2

IIAssume the variable below are declared and initialized as shown:

(1 point each) no calculators!

int n, m;

double x, y;

n = 23; m = 5; x = 2.3; y = 4.5;

What is the value of each expression below?

1. n/m = _______ 2. n % m = ______ 3. 25 % m = _____ 4. m / n = ______

5.n- x * 2 = _____ 6. y – x + m = _______ 7. (double)n / m =______

num (num + 1)

sum = ------------------

2

IIAssume the variable below are declared and initialized as shown:

(1 point each) no calculators!

int n, m;

double x, y;

n = 23; m = 5; x = 2.3; y = 4.5;

What is the value of each expression below?

1. n/m = _______ 2. n % m = ______ 3. 25 % m = _____ 4. m / n = ______

5.n- x * 2 = _____ 6. y – x + m = _______ 7. (double)n / m =______

Expert's answer

public class Question {

public static void main(String[] args) {

int num = 1;

int sum = num * (num + 1) / 2;

System.out.println(sum);

int n = 23;

int m = 5;

double x = 2.3;

double y = 4.5;

System.out.println(n / m);

System.out.println(n % m);

System.out.println(25 % m);

System.out.println(m / n);

System.out.println(n - x * 2);

System.out.println(y - x + m);

System.out.println((double) n / m);

}

}

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment