Dividing 10/100 in java gives me an answer of 0
double s = 10/100;
System.out.println(s);
I don't understand why that happens , can anyone help me?
Thanks
Dividing 10/100 in java gives me an answer of 0
double s = 10/100;
System.out.println(s);
I don't understand why that happens , can anyone help me?
Thanks
just do a casting like this
double s = (double)10/100;
System.out.println(s);
that'll do. Oh, and do as #SURESH ATTA suggests in the comment.