KnowledgeBoat Logo
|

Computer Applications

Determine the data type of the expression

(100(1pq)(q+r))((p+r)/s(long)(s+p))\Big(\dfrac{100(1 - pq)}{(q + r)}\Big) - \Big(\dfrac{(p + r) / s}{(\text{long})(s + p)}\Big)

If p is an int, r is a float, q is a long and s is double.

Values & Data Types Java

9 Likes

Answer

The result of the given expression will be double type.

Explanation

(int(intintlong)(long + float))((int+float)/double(long)(double+int))(int(intlong)float)(float/doublelong)(intintfloat)(doublelong)floatdoubledouble\Big(\dfrac{\text{int} * (\text{int} - \text{int} * \text{long})}{\text{(\text{long} + \text{float})}}\Big) - \Big(\dfrac{(\text{int} + \text{float}) / \text{double}}{(\text{long})(\text{double} + \text{int})}\Big) \\[1em] \Rightarrow \Big(\dfrac{\text{int} * (\text{int} - \text{long})}{\text{float}}\Big) - \Big(\dfrac{\text{float} / \text{double}}{\text{long}}\Big) \\[1em] \Rightarrow \Big(\dfrac{\text{int} * \text{int}}{\text{float}}\Big) - \Big(\dfrac{\text{double}}{\text{long}}\Big) \\[1em] \Rightarrow \text{float} - \text{double} \\[1em] \Rightarrow \text{double}

Answered By

5 Likes


Related Questions