What is the value assigned to numerous in the statement: double num =5/2; ? Explain the concept of variable casting and show how | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

What is the value assigned to numerous in the statement: double num =5/2; ? Explain the concept of variable casting and show how

14th Apr 2017, 7:26 AM
ike Abek
3 Respuestas
+ 7
@Babak Sorry, and thanks for that. Deleting my answers not to confuse
14th Apr 2017, 9:05 AM
Dinmukhamed Mailibay
Dinmukhamed Mailibay - avatar
+ 2
5 / 2 result is 2, but 5.0 / 2.0 is gonna be 2.5 for more info see: http://www.cprogramming.com/tutorial/lesson11.html
14th Apr 2017, 7:49 AM
Babak
Babak - avatar
+ 2
@ Dinmukhamed Despite the nature of double or float types, the rValue determines how the lValue is going to behave. So, Please test it with 5, 5.0 , and 5.0f.
14th Apr 2017, 8:32 AM
Babak
Babak - avatar