Thread: how to get remainder of a value

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    38

    how to get remainder of a value

    say we divded 137 by 50... the asnwer is 2, now we have 37 left... is there a way to just store this info?

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Yep. You can do modulus using the % operator. Thus, 137 % 50 = 37.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    38
    cool thx man exactly it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting 32 bit binary IP to decimal IP (vice-versa)
    By Mankthetank19 in forum C Programming
    Replies: 15
    Last Post: 12-28-2009, 07:17 PM
  2. Why so many programs return wrong remainder?
    By Ezzetabi in forum Tech Board
    Replies: 9
    Last Post: 07-30-2005, 03:22 PM
  3. Finding a remainder when dividing
    By dustyd in forum C Programming
    Replies: 3
    Last Post: 01-22-2003, 09:31 PM
  4. Find integer 1- 1000 w/ most divisors w/o remainder
    By AlexDeToi in forum C++ Programming
    Replies: 3
    Last Post: 03-24-2002, 08:45 PM
  5. Replies: 3
    Last Post: 02-25-2002, 11:19 AM