What are the values of the following expressions? In each line assume that,

double x = 2.5;

double y = -1.5;

int m = 18;

int n = 4;

String s = "Storm";

String t = "Watch";

x + n*y - (x+n)*y ______________

m/n + m%n ______________

Respuesta :

Answer:

double x = 2.5;

double y = -1.5;

int m = 18;

int n = 4;

string s = "Storm";

string t = "Watch";

The output of the expression "x + n*y - (x+n)*y" is "6.25".

and the output of expression "m/n + m%n" is "6".

Explanation:

for the first expression,

x + n*y - (x+n)*y ,put value of every variables in it.

=2.5+4*(-1.5)-(2.5+4)*(-1.5)

=2.5-6.0-(6.5*(-1.5)

=-3.5+9.75

=6.25

for the second expression,

m/n + m%n,  put value of every variables in it.

=18/4 +18%4

=4+2      ("/ will give quotient and % will give remainder")

=6