Computer Science, asked by Mɪʀᴀᴄʟᴇʀʙ, 4 months ago

Write the Java expressions for the following:

i. (a + b)² + b

ii. z = x³ + y³ + \dfrac{xy}{3}

Answers

Answered by BrainlyProgrammer
27

Java expression for the following:-

  1. (a+b)²+b
  2.  \sf \: z=x³+y³+ \frac{xy}{3}

Answer:-

There are two ways to write it as a Java Expression:-

\sf{(a+b)^2 + b}

  • Math.pow((a+b),2)+b
  • ((a+b)*(a+b))+b

\sf{x^3 + y^3 + (\dfrac{xy}{3})}

  • z=(x*x*x)+(y*y*y)+((x*y)/3);
  • z=Math.pow(x,3)+Math.pow(y,3)+((x*y)/3);

Note:-

  • Math.pow() returns the number raised to power other number
  • It always returns the double type value

More about Math Functions:-

  1. Math.max() is used to find the maximum value between 2 numbers. SYNTAX:- Math.max(a,b);
  2. Math.min() returns the minimum value between two numbers. SYNTAX:- Math.min(x,y);
  3. Math.abs() returns absolute value of the given number. SYNTAX:- Math.abs();
  4. Math.ceil() returns rounded value upto nearest higher integer. SYNTAX:- Math.ceil(x);
  5. Math.floor() returns rounded value upto nearest lower integer. SYNTAX;- Math.floor(x);
  6. Math.round() returns the rounded value of the number upto nearest integer.
  7. Math.cbrt() returns cube root of a number. SYNTAX:- Math.cbrt(x);
  8. Math.sqrt() returns square root of a number. SYNTAX:- Math.sqrt(x);

TheMoonlìghtPhoenix: Wowsome!
Skyllen: Nice :))
Answered by GraceS
0

\tt\huge\purple{hello!!!}

HERE IS UR ANSWER

_____________________________

refer attachment

Attachments:
Similar questions