Thread: c help

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    25

    Talking c help

    hello... i'm new here and it has been months since i have started programming.....and its fun....

    can anyone help me......1%3==1?

    that's what my professor has told me and i could not gets() the logic of this?
    TEACH ME....
    :-);-)

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    How many times does 3 go into 1?
    Zero.
    Whats left over?
    One.

    gg

  3. #3
    Registered User
    Join Date
    Jan 2003
    Posts
    115
    % = modulus

    it will take the remainder of two ints.
    example

    12%7 = 5

    (7 goes into 12 once , and there is a remainder 5 )

    20%4 = 0

    (4 goes into 20 five times, and there is no remainder )

    1%3 = 1

    (3 goes into 1 zero times, and there is 1 remainder )

    hope that helps
    there are only 10 people in the world, those who know binary and those who dont

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    The % operator is the modulus, the / operatoris is the divisor and it is applicable to integer variables. It has to do with the remainder of a division.

    In integer calculus you get the following:

    7 / 3 = 2

    Now

    2 * 3 = 6

    So there is a remainder

    7 - 6 = 1

    This can directly be calculated using the modulus operator

    7 % 3 = 1

    In your example

    1 / 3 = 0
    0 * 3 = 0
    1 - 0 = 1

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    25
    Oh.... I see now Understand......
    thanx...
    TEACH ME....
    :-);-)

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    25
    excuse me can anyone tell me the difference between bubble and baloon sort? && what is the syntax for baloon and merge sort...
    TEACH ME....
    :-);-)

  7. #7
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Posts
    807
    v@grant, search in google, or in the board, you'll find a lot of info.

  8. #8
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380

  9. #9
    Registered User
    Join Date
    Mar 2003
    Posts
    25
    Originally posted by Shiro
    Some links to overviews of sorting algorithms.
    http://linux.wku.edu/~lamonml/algor/sort/sort.html
    http://www.cs.hope.edu/~alganim/ccaa/sorting.html


    thanks Shiro, for the tip....
    Last edited by v@grant; 03-19-2003 at 08:08 PM.

  10. #10
    Registered User
    Join Date
    Mar 2003
    Posts
    25
    Originally posted by Vber
    v@grant, search in google, or in the board, you'll find a lot of info.
    thanks.........
    TEACH ME....
    :-);-)

Popular pages Recent additions subscribe to a feed