1. Write the Java expression for the following (a² + b²) + 2ab
Find the output of the following:
a) If int x=7 find the value of X+ = x++ +++X + --X + X c)Math.abs(Math.cell(-99 51))
d)Math.round(10.4)
e)System.out.println(1+1+"two");
Answers
Answered by
6
Q. Write the java expression for the following :
int x;
x = (Math.pow(a, 2) + Math.pow(b, 2)) + 2 * a * b;
Q. Find the output of the following :
a) If int x=7 find the value of X += X++ + ++X + --X + X
==> 39 is the output.
c) Math.abs(Math.cell(-99.51))
==> 98 as 'abs' function returns the absolute value and ceil rounds it to nearest higher integer.
d) Math.round(10.4)
==> 10 as round function rounds the number to nearest integer.
e) System.out.println(1+1+"two");
==> 2two as first the two integers add up and then concatenate to the string..
I hope that my answer helped you...
Similar questions