Thread: if a multiple of 10.... do something

  1. #1
    Registered User
    Join Date
    Sep 2010
    Location
    London
    Posts
    41

    if a multiple of 10.... do something

    Hello,

    How can I program in if a number is a multiple of 10 then output it?

    Can't think of a way to do it....

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    modulus operator '%' returns the remainder of a division.

    if( x % 10 == 0 ) //is divisibe by ten
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Sep 2010
    Location
    London
    Posts
    41
    Thank you very much.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multiple syntax errors
    By Devolution in forum C Programming
    Replies: 1
    Last Post: 03-25-2009, 10:37 PM
  2. Spore in 4 days.
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 64
    Last Post: 09-29-2008, 09:54 AM
  3. Problem I Can't solve...
    By ferniture in forum C Programming
    Replies: 3
    Last Post: 07-15-2008, 02:51 AM
  4. Replies: 1
    Last Post: 05-01-2003, 02:52 PM

Tags for this Thread