Fractions in Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Fractions in Java

Help with Java fractions! ¼ how it write in code? and other activities?

29th Jan 2018, 2:34 PM
Grey King
Grey  King - avatar
3 Answers
+ 17
1/4 is equal to 0 in java //bcz integer/integer returns an integer in java U can use double type for that double a=1.0/4.0 or double a=(double)1/4; //don't write "double a=1/4" bcz it will become double a=0 ie a=0.0
29th Jan 2018, 2:39 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
and that's it? You genius! Thanks! I try to find it but I can't find it ( and it all explanation of fractions ? What about fractions 6/4 ? and other ? 2 1/5 ?
29th Jan 2018, 7:07 PM
Grey King
Grey  King - avatar
+ 2
20ˣ⅓+158² how to count this? And write in code!
29th Jan 2018, 7:09 PM
Grey King
Grey  King - avatar