Thread: smaller number modulo bigger number all equals smaller number

  1. #1
    Registered User Fauveboy's Avatar
    Join Date
    Apr 2014
    Posts
    42

    smaller number modulo bigger number all equals smaller number

    I can comprehend why any number smaller that the number the other side of modulo equals the smaller number. How does this work?

    Code:
    int main()
    {
    int mod = 2;
        
    mod %= 12;
        
    cout << ": " << mod << endl;
    
    
    return 0;
    }

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    Can you explain in your own words what modulo is?

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  3. #3
    Banned
    Join Date
    Aug 2017
    Posts
    861
    self explanatory look at the code
    modulus
    Last edited by userxbw; 12-01-2017 at 11:52 AM.

  4. #4
    Informer -Adrian's Avatar
    Join Date
    Jan 2013
    Posts
    799
    Quote Originally Posted by userxbw View Post
    self explanatory look at the code
    modulus
    Thanks!


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 11-11-2017, 01:26 AM
  2. Replies: 2
    Last Post: 09-30-2015, 09:15 AM
  3. New Smaller and Smaller Arrays.
    By jastiv in forum Game Programming
    Replies: 1
    Last Post: 07-02-2012, 01:37 PM
  4. Input a Hex number and output hex number to a text field
    By zoobaby in forum C++ Programming
    Replies: 4
    Last Post: 05-12-2009, 11:26 AM
  5. finding the least bigger number from the tree
    By transgalactic2 in forum C Programming
    Replies: 0
    Last Post: 04-12-2009, 03:34 PM

Tags for this Thread