# Thread: Using int/int, 7/5 would return 1

1. Member Join Date
Jul 2007
Posts
40
Rep Power
0

## Using int/int, 7/5 would return 1

I'm programming in Java. I'm trying to make a program that inputs money (as a double) and determines the amount of different coins to give.
My problem is, I input a value as a double, and try to divide by a number to get the number of times it goes into that number, and get a remainer.
For example, using int/int, 7/5 would return 1.
But dividing double/double 7.0/5.0 returns an exact double. How to i get int "1" out of that?
Thanks.  Reply With Quote

2. Member Join Date
Jul 2007
Posts
55
Rep Power
0

## double x = 12;
int y = new Double(x).intValue();  Reply With Quote

3. Member Join Date
Nov 2008
Posts
85
Rep Power
0

## Re:

Hi,
If u use below code,U must get the output as 1.

double q=7.0;
double w=5.0;
double s=(q/w);
int r=new Double(s).intValue();  Reply With Quote

#### Posting Permissions

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