211k views
15 votes
Int iNum = (int) 38.78;

User Florent Gz
by
5.6k points

1 Answer

9 votes

Answer:

iNum = 38

Step-by-step explanation:

Given

int iNum = (int) 38.78;

Required

What is the value of the variable?

In the above instruction, the variable is iNum and its value is 38

This is so, because int iNum = (int) 38.78; means that the integer part of 38.78 be stored in iNum.

In 38.78, the integer part is 38 and the fractional part is 0.78.

Hence, 38 will be saved in iNum and the 0.78 be discarded

User Fanli
by
5.1k points