• Post Reply Bookmark Topic Watch Topic
  • New Topic

modulo problem  RSS feed

 
Anne Buena
Greenhorn
Posts: 14
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you must be joking
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!