1. Member
Join Date
Oct 2013
Posts
13
Rep Power
0

## double Problem

Java Code:
```double absorbPercent;
absorbPercent = 122/545;
System.out.println(absorbPercent);```
122/545 is suppose to give me 0.223853211 but it gives me 0.0
If it is possible, what i only want is for it to store 2 decimal places after the 0.
So 0.22

- Thank you for your time!

2. Senior Member
Join Date
Oct 2010
Location
Germany
Posts
787
Rep Power
8

## Re: double Problem

122 and 545 are both integers. int/int = int

-->
absorbPercent = 122./545
or
absorbPercent = (double)122/545;
or
.....

3. Member
Join Date
Oct 2013
Posts
13
Rep Power
0

## Re: double Problem

Originally Posted by eRaaaa
122 and 545 are both integers. int/int = int

-->
absorbPercent = 122./545
or
absorbPercent = (double)122/545;
or
.....
Thank you mate!
I will look into this, i appreciate your help :)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•