Multiple of 3

This is a discussion on Multiple of 3 within the C Programming forums, part of the General Programming Boards category; Does anyone know how to check whether a number is a multiple of 3 without using arithmatic operators!!!!!!! Thanks in ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    2

    Multiple of 3

    Does anyone know how to check whether a number is a multiple of 3 without using arithmatic operators!!!!!!!
    Thanks in advance!!!!

  2. #2
    Awesomefaceradcore bivhitscar's Avatar
    Join Date
    Apr 2006
    Location
    Melbourne, Australia
    Posts
    210
    How could you do it without arithmetic operators; surely that's impossible?

    Or are you meant to use bit-fiddling techniques?
    it's ironic considerate rarity patron of love higher knowledge engulfs me...

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    7
    I believe you use 'mod'.

    For example

    if( 15mod3 == 0 ) {

    I think. Not sure.

    EDIT* Actually on another post, I realise maybe instead of 'mod' it would be '%'

  4. #4
    Registered Luser risby's Avatar
    Join Date
    Jun 2006
    Posts
    72
    Quote Originally Posted by dwlu244
    I believe you use 'mod'.

    For example

    if( 15mod3 == 0 ) {

    I think. Not sure.

    EDIT* Actually on another post, I realise maybe instead of 'mod' it would be '%'
    Don't you count the modulus operator '%' as an arithmetic operator then?
    ===
    Don't grumble about what you can't have;
    be grateful you don't get what you deserve.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 06-08-2009, 03:03 PM
  2. why Multiple define error ...
    By nilathinesh in forum C Programming
    Replies: 2
    Last Post: 10-19-2006, 06:31 AM
  3. Phantom redefinition
    By CodeMonkey in forum C++ Programming
    Replies: 6
    Last Post: 06-12-2005, 05:42 PM
  4. Linker errors - Multiple Source files
    By nkhambal in forum C Programming
    Replies: 3
    Last Post: 04-24-2005, 02:41 AM
  5. Replies: 1
    Last Post: 05-01-2003, 02:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21