programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering OS Languages Paradigms IDEs Build Tools Frameworks Products This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Sheriffs:
Saloon Keepers:
Bartenders:

# modulo problem

Anne Buena
Greenhorn
Posts: 14
if i have for example a number 145, how will i know if how many times it can be divided by 60. pleaseeee answer. thank you in advance!

Michael Dunn
Ranch Hand
Posts: 4632
you must be joking

Winston Gutkowski
Bartender
Posts: 10575
66
• 1
Anne Buena wrote:if i have for example a number 145, how will i know if how many times it can be divided by 60. pleaseeee answer. thank you in advance!

Please EaseUp (←click). Urgency is your problem, not ours, and we're all volunteers here.

However, here's one for you: How do you think you might work out how many times 145 can be divided by 60? How would you do it on paper?

Winston

Anne Buena
Greenhorn
Posts: 14
sorry for that.. 145-60 then minus 60 again. but how what if it's not divisible by 60? what should be my algorithm?

Henry Wong
author
Sheriff
Posts: 23295
125
Anne Buena wrote:if i have for example a number 145, how will i know if how many times it can be divided by 60. pleaseeee answer. thank you in advance!

Anne Buena wrote:sorry for that.. 145-60 then minus 60 again. but how what if it's not divisible by 60? what should be my algorithm?

Not sure what you are trying to do here... Java has a divide operator that can do the division for you.

Henry

Anne Buena
Greenhorn
Posts: 14
Example.. I have 145. I can use 145%60 to know it's remainder. The problem is, how would I know if how many times there will be 60 in 145. Sorry for my bad english.

Henry Wong
author
Sheriff
Posts: 23295
125
Anne Buena wrote:Example.. I have 145. I can use 145%60 to know it's remainder. The problem is, how would I know if how many times there will be 60 in 145. Sorry for my bad english.

How about the divide operator? ie.... 145 / 60 ?

Henry

Anne Buena
Greenhorn
Posts: 14
Oh i got it. I just have to declare it in int so it will not have any decimal point. Thank you so much. I'm having programmer's block. Hahaha. Thank you!