0
How is 15/4 =3?
11 Answers
+ 2
because 15/4=3.75
but data type is int so only integer part of 3.75 (i.e 3)is displayed neglecting decimal part. if we use float or double then we would have got 3.75
+ 1
its variable type is int which hold only whole numbers so it records only the 3 and the rest is omitted
+ 1
The answer depends on the variable and data type you assign to that number. int strictly avoids floating point values (values after decimal.point) so the answer will be just 3. For float and double the answer will be different.
0
15/4 = 3.75 but if u will assign it's value in int variable then it will only consider 3 neglate the floating point value
0
change data type from int to double... u will get full answer
0
cause ur using the initialization of the number as an int which means whole number, you can use double here preferably to get the number in a decimal form or float as well, good luck
0
4 goes 3 times into 15 and remainder comes 3. that's it. thankx
0
it is so cuz....
if you will use int a=15;b=4;c=a/b; then you get 3 as a solution.
but if you use float c=a/b; then you get the right answer.
it is so because int data type only stores the integer values and float stores the integer as well as decimal values also.
0
Java or C initializes the result into integer if the user doesn't specifies it.
for the 15/4 problem, if double a = 15/4 was given, it would give you, 3.75. but since you didn't mention, the data type, java compiler took it as int
- 3
convert the result to Integer
Integer. parseInt(qoutient);
- 6
when u divide these two numbers then it's reminder is 3