+ 2
Fractions in Java
Help with Java fractions! ¼ how it write in code? and other activities?
3 Réponses
+ 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
+ 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 ?
+ 2
20ˣ⅓+158² how to count this? And write in code!