# Thread: really quick question for beginner

1. Member
Join Date
Jun 2010
Posts
2
Rep Power
0

## really quick question for beginner

hey there, im making a little program that converts celcius to farenheit blah blah not important

heres the situation:

celcius = c
farenheit = f
(bot c and f are doubles)

c = (5/9) * (f-32)

weird thing is using that equation doesnt work and my value for C will be zero

i know it a problem with 5/9 because if i use someone like 10/5 itll work just fine. so whats the problem with 5/9? is division whacky in java or something?

2. You are stumbling against int division. You see an int divided by an int will result in an int, with rounding and all. Convert one to a double:

c = (5.0/9.0) * (f-32)

3. Member
Join Date
Jun 2010
Posts
2
Rep Power
0
mmmother F! so simple! thanks!

4. You're quite welcome. Welcome to the forum by the way!

5. Originally Posted by Fubarable
You are stumbling against int division. You see an int divided by an int will result in an int, with rounding and all. Convert one to a double:

c = (5.0/9.0) * (f-32)
Assign 5/9 into a local int variable and see what's the result. Situations like this you can do that.

#### Posting Permissions

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