Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

division and testing for whole number result  RSS feed

 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello. if anybody has a minute, I was looking for a way to see if one integer divides evenly inot a larger interval (ie. with nothing after the decimal). I was thinking parseInt and catch an exception on it but that doesn't do it. Does anybody have any suggestions? Thank you very much for reading this.
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about using the modulus (%) operator?
 
Tom Griffith
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh yeah...i forgot about that. thank you.
 
Sridhar Santhanakrishnan
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!