+ 1
Please guys in java how do i call a variable whose value is a decimal and i want to subtract it from a variable that is an int.
3 Respuestas
+ 3
By decimal, did you mean floating point value like 123.45?
If so, you can simply assign the subtraction result into another variable e.g.
<floating-point-var> = <floating-point-var> - <integer-var>;
Tell some more if you're facing a problem. I'm not too sure if this was what you seek for.
0
Ex: Victor Okereafor
int i=10;
double j=5.0;
i = (int)(i - j); // need casting to int back...
System.out.print(i);
Post code snippet which is troubling you....