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?

This is a discussion on *c help* within the **C Programming** forums, part of the General Programming Boards category; 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?
...

- 03-11-2003 #1

- Join Date
- Mar 2003
- Posts
- 25

## 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....

:-);-)

- 03-11-2003 #2
How many times does 3 go into 1?

Zero.

Whats left over?

One.

gg

- 03-12-2003 #3

- 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 helpsthere are only 10 people in the world, those who know binary and those who dont

- 03-12-2003 #4

- Join Date
- Aug 2001
- Location
- Groningen (NL)
- Posts
- 2,386

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

- 03-12-2003 #5

- Join Date
- Mar 2003
- Posts
- 25

Oh.... I see now Understand......

thanx...TEACH ME....

:-);-)

- 03-15-2003 #6

- 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....

:-);-)

- 03-16-2003 #7
v@grant, search in google, or in the board, you'll find a lot of info.

- 03-16-2003 #8

- Join Date
- Aug 2001
- Location
- Groningen (NL)
- Posts
- 2,386

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

- 03-19-2003 #9

- 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.

- 03-19-2003 #10

- 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.**TEACH ME....

:-);-)

- Exactly how to get started with C++ (or C) today
- C Tutorial
- C++ Tutorial
- 5 ways you can learn to program faster
- The 5 Most Common Problems New Programmers Face
- How to set up a compiler
- 8 Common programming Mistakes
- What is C++11?
- Creating a game, from start to finish

- How to create a shared library on Linux with GCC - December 30, 2011
- Enum classes and nullptr in C++11 - November 27, 2011
- Learn about The Hash Table - November 20, 2011
- Rvalue References and Move Semantics in C++11 - November 13, 2011
- C and C++ for Java Programmers - November 5, 2011
- A Gentle Introduction to C++ IO Streams - October 10, 2011