100% found this document useful (1 vote)
243 views6 pages

Java Expression

This document contains 10 math questions with their equivalent expressions in Java code. The questions cover a variety of mathematical operations including exponents, logarithms, trigonometric functions, absolute values, and square roots. The corresponding Java answers use methods like pow(), sqrt(), log(), abs(), and trig functions to replicate the math expressions.

Uploaded by

avni patel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
100% found this document useful (1 vote)
243 views6 pages

Java Expression

This document contains 10 math questions with their equivalent expressions in Java code. The questions cover a variety of mathematical operations including exponents, logarithms, trigonometric functions, absolute values, and square roots. The corresponding Java answers use methods like pow(), sqrt(), log(), abs(), and trig functions to replicate the math expressions.

Uploaded by

avni patel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 6

Question 1

Vab +cd
Answer
+

Math. cbrt(a * b C *
d)

Question 2

1
--r
2

Answer

Math. pow(p, 3) + Math.pow (g, 4)


(1.0 / 2.0 r)

Question 3

-b + b 4ac
2a

Answer

(-b + Math. sqrt( (b * b) - (4


c))) / (2.0* a)
Question 4

0.05 - 2y
(x- y)
Answer

(0.05 - (2 ** Math.pow(y, 3))) / (x


y)

Question 5

Vmn +Vm+n)
Answer

Math.sqrt (m * n) + Math.cbrt (m + n)

Question 6
3 2
4
(a + b) 5
ab

Answer

(3.0 / 4.0 (a + b)) - (2.0/ 5.0


a * b)
Question 7

3
(B' + c)
Answer

3.0 / 8.0 * Math.sqrt( (Math. pow(b,2)

+ Math.pow(c,3)))

Question 8

Va +b
Answer

Math.cbrt(a) + Math.pow (b,2) -


Math. cbrt(c)

Question 9

Va+b + cß
3
Answer

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


Math.pow(c, 3)) / 3
Question 10

V3x + x?
(a + b)
Answer

Math. sqrt(3 * x + Math. pow (x,2)) /


(a + b)

Question 11

z= x°+y

Answer

= Math.pow(x,3) + Math.pow(y,3) -
y / Math.pow (z,3)

Question 12
1 3
+
Va b

Answer

g =1 / Math. sqrt (a + b) + 3 /

Math. pow(c,2)
1. Write the equivalent Javasyntax for the
following expression:
0.05 - 2y
X- y
Ans:a =(0.05 -2 * Math.pow(y, 3))/(x-y);
2. Write a Java expression for:
(a+b).n
V3 + b
Ans: Math.pow((a+b),n)/Math.sqrt(3)+b)
3. Write a Java expression for:
V2as + u2
Ans: Math.sqrt(2*a*s + Math.pow(u, 2):
4. Write a Java expression for:
cos X+ a+ b2
Ans: Math.cos(x) + Math.sqrt(Math.pow(a,2) +
Math.pow(b,2);
5. Write a Java expressionfor the following
mathematical operation:
z=x°+y3.3Y
Ans: z = Math.pow(x,3) + Math.pow(y,3) -(x*y)/z;
6. Write an expression in Java for:
sin x + ax + bx +c
Ans: Math.sin(x) + Math.sqrt(a*Math.pow(x,2) +
b*x+ c);
5. Write a Java expressionfor the following
mathematicaloperation:
Xy
z=x® +y° Z
Ans: z = Math.pow(x,3) + Math.pow(y,3) - (x*y)/z;
6. Write an expression in Java for:
sin x + vax + bx +c
Ans: Math.sin(x) + Math.sqrt(a*Math.pow(x,2) +
b*x+ c);
7. Write the corresponding Java expression for
the folloiwng:

Ans: Math.sqrt((Math.pow(a,5) +
Math.pow(b,5))/9):
8.Write the expression for the absolute value of
V2x° /3y4
Ans: Math.abs(Math.sqrt(2 *Math.pow(x,3) /3 *
Math.pow(y,4)));
9. Write aprogram code to evaluate log(vx + yß
Iy)
Ans: Math.log(Math.sqrt(Math.pow(x,2) +
Math.pow(y,3)) / y);
10. Write an expression in Java for:
Z= 5x3+2y
X+y
Ans: z = (5* Math.pow(x,3) + 2 *y) / (x + y);

You might also like