Computer Science, asked by ayushibanik2006, 6 hours ago

write down the java expression for:-
a =  \sqrt{x}^{2}  +  {y}^{2} + {z}^{2}

Answers

Answered by BrainlyProgrammer
18

Java expression for:

  •  \green{a = \sqrt{x}^{2} + {y}^{2} + {z}^{2}}

Required Answer:-

  • a = Math.sqrt ( Math.pow ( x , 2) ) + Math.pow ( y , 2 ) + Math.pow ( z , 2 );
  • a = Math.pow ( Math.pow ( x , 2 ) ,0.5 )+ Math.pow (y , 2)+ Math.pow(z , 2);
  • a = Math.sqrt(x*x) + y*y + z*z

________

Note:-

  • Math.sqrt(number) :- Returns the square root of a number. Return data type: double.
  • Math.pow(number, power) :- Returns number raised to power. Ex:  \sf \it {(number)}^{power} . Return data type: double.

______

More about Math Functions:-

  • Math.ceil(a) - Rounds the number upto next higher integer. Return data type: Double
  • Math.floor(a) - Rounds the number upto next lower integer. Return data type: Double.
  • Math.max(a,b)- Returns the maximum value between two parameters. Return data type: Depends on the data type of the parameters.
  • Math.min(a,b)- Returns minimum value between two parameters. Return data type: Depends on the data type of the parameters.
  • Math.cbrt(a)- Returns cube root. Return data type: Double.
  • Math.sqrt(a)- Returns square root. Return data type: Double.
  • Math.log(a)- Returns natural logarithmic value of a given argument. Return data type: Double.
  • Math.round(a)- Returns the number rounded to the nearest integer. (For more info: Please check the Knowledge box given at last.)
  • Math.rint(a)- Returns the nearest integer of a given number. Return data type: double
  • Math.exp(a)- Returns exponential value of a given argument. Return data type: Double
  • Math.random()- There are no argument in this function and it returns random number between 0 and 1. Return data type: double
  • Math.PI - Returns the value of pi(π)

_______

Knowledge Box...!

  • It is necessary to know that round() and rint() are not same. Math.round() returns number in data type of the parameters while Math.rint() returns number in double data type.
  • Another Difference... Let's take -9.5 as a parameter Math.round(-9.5) will return -9 while Math.rint(-9.5) returns -10.0
Answered by SƬᏗᏒᏇᏗƦƦᎥᎧƦ
41

Question given:

Write down the java expression for:-

  •  \sf{a = \sqrt{x}^{2} + {y}^{2} + {z}^{2} }

Answer formation:

  • Sqrt means square root

We would be using,

  • Math.sqrt as x it is in square root
  • Math.pow as x is raised to the power 2

So answer would be,

  \pink\bigstar  \red{\boxed{ \tt{a \:  = \:  Math.sqrt ( Math.pow ( x , 2) ) + Math.pow ( y , 2 ) + Math.pow ( z , 2 )}}}

Additional Information:

  • Method is a named block of a códe in a class. It is executed within a defined set of instructions.
  • Methods and variables of math class are defined as static members.
  • Java.lang package contains classes and interfaces which are fundamental to Java programming language.
  • The math class of java.lang package contains generic mathematical functions including some geometric and trigonometric function.
  • Math.cbrt returns cube root of a double value.
  • Math.ceil returns smallest integer which is greater or equal to the argument.
  • Math.abs returns us the absolute value of a given argument.
  • Math.pow it returns us the value of a first given argument raised to the power of the given second argument.
  • Double datatype is used if a output comes in decimal.

More similar questions:

  • https://brainly.in/question/42140095?
  • https://brainly.in/question/30816677?
  • https://brainly.in/question/18010374?
  • https://brainly.in/question/44313763?
Similar questions