I think you assigned the value to an int. Try double:
// decimal will be 0.1
double decimal=10/100;

On Mar 13, 8:53 pm, Jerrold <[email protected]> wrote:
> Yes, something like that Alfonso, but the problem is if the dividend
> is grater than the divisor as with percentage the result with this in
> java is 0.
>
> say for example i want to know the 10% of 500. to do this i would have
> to take the decimal of 10% which is 10/100 then multiply it with 500
> so get the 10% value of 500. the problem is in java 10/100 is equal to
> 0.
>
> On Mar 13, 4:48 am, Alfonso Bullon <[email protected]> wrote:
>
> > Hi Jerrold
>
> > Do you mean something like this?:
>
> > public double myMethod(double d){
> > return d/100;
>
> > }
>
> > 2009/3/12 Jerrold <[email protected]>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to