Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Select a convenient declaration and initialization of a floating point number:

a) float somevariable = 12.502D
b) float somevariable = (Double) 12.502D
c) float somevariable = (float) 12.502D
d) float somevariable = (Decimal)12.502D

Answer: c
Explanation: We cannot implicitly convert a “double” number directly to any other data type. Here, its float we have to add the required data type to number as :
float somevariable = (float)12.502D; or Double somevariable = (Double)12.502D;

Join The Discussion