Determine the data type of this expression | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Determine the data type of this expression

{(2x+3y/5w+6z)+8p/5q}. If x is int,y is long,w is float,z is double,p is short and q is long double.

1st Aug 2018, 11:52 AM
Siddhi Agarwal
3 Answers
+ 2
well, if w is a float then y is converted into a float too, meaning x will also be converted into a float. then the result there will be converted into a double because float + double results in a double. then p is converted into a long double, then double + long double is converted into long double, meaning the final. result of the expression is a value of "long double" type.
1st Aug 2018, 12:19 PM
hinanawi
hinanawi - avatar
0
Ok
5th May 2020, 12:37 PM
Meghna Dutta
Meghna Dutta - avatar
- 1
tysm
1st Aug 2018, 12:47 PM
Siddhi Agarwal