division - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

division

Im not clear on division and the remainder %.

Am i suppose to use both the / sign ( to get the main division between two numbers) and then the % sign ( to get the remainder from the answer from the division)in a single division problem to get the remainder?

or else

am i suppose to replace the / sign with the %

this is a little bit confusing?

thank you

Comments

  • DonotaloDonotalo Posts: 715Member
    : Im not clear on division and the remainder %.
    :
    : Am i suppose to use both the / sign ( to get the main division between two numbers) and then the % sign ( to get the remainder from the answer from the division)in a single division problem to get the remainder?
    :
    : or else
    :
    : am i suppose to replace the / sign with the %
    :
    : this is a little bit confusing?
    :
    : thank you
    :
    [purple]
    no, they are seperate operators. if u need the remainder, use only % and when u need division, simply use /.[code]
    int x = 46, y = 13;
    cout << "x%y = " << x%y << endl;
    cout << "x/y = " << x/y << endl;
    [/code]
    see what happens when u run the above code. :-)
    [/purple]
    [hr][purple]~Donotalo()[/purple]

  • zeroscspotzeroscspot Posts: 40Member
    ok, thanks for clearing that up.
Sign In or Register to comment.