Computer Science, asked by purvanshchordia, 1 month ago

Write the java equivalent expression for the following x=a2+b2

Answers

Answered by usman4916950
0

Answer:

Math.sqrt(Math.pow(a,2)+Math.pow(b,2)

Answered by SƬᏗᏒᏇᏗƦƦᎥᎧƦ
5

Corrected question :

Write the java equivalent expression for the following:-

  • x = a² + b²

Explaination :

  • Here we would be using pow method because the value of the first argument that is a, raised to the power of second argument that is 2.
  • In second b is being raised to the power 2 so here also pow method would be used.

Generic syntax:-

  • Math.MethodName(arguments)

Syntax of pow method:-

  • Math.pow (x , y)

Final Answer:-

  • x = Math.pow (a , 2) + Math.pow (b , 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.max method gives us the largest of two given arguments
  • Math.min method gives us the smallest of two given arguments

More similar questions :

  • https://brainly.in/question/20782361
  • https://brainly.in/question/20735428
  • https://brainly.in/question/35751426
  • https://brainly.in/question/24154252
  • https://brainly.in/question/20191304
Similar questions