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?
Printable View
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?
How many times does 3 go into 1?
Zero.
Whats left over?
One.
gg
% = 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
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
Oh.... I see now Understand......
thanx...:D
excuse me can anyone tell me the difference between bubble and baloon sort? && what is the syntax for baloon and merge sort...
:D
v@grant, search in google, or in the board, you'll find a lot of info.
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
Quote:
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....:D
thanks.........:DQuote:
Originally posted by Vber
v@grant, search in google, or in the board, you'll find a lot of info.