answersLogoWhite

0


Best Answer

Division is what you expect it to be, the division of two numbers with the result placed somewhere.

Modulus, on the other hand, is the remainder of integer division of two numbers with the result placed somewhere. The modulus function of a and b, a being the dividend and b being the divisor, is a - int(a/b) * b.

For example, using integer results...

47/4 = 11

47%4 = 3

Check it: 47 = 11*4 + 3

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

10y ago

a%b evaluates to the remainder of a divided by b

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

You can use abs function but you will have to include cstdlib:

include <cstdlib>;

...

int myVar = -10;

...

int myAbsVar = abs(myVar);

...

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Explain the modulo division operator in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the 5 types of operation in info processing?

They are + , - , * , / , % (Modulo-&gt;It evaluates the remainder of a division.) NOTE: The % operator is modulo only in the C-based languages. In the VB languages, it is Mod ex: a = 5 b = 2 c = a + b (result is 7) c = a - b (result is 3) c = a * b (result is 10) c = a / b (result depends on language... either 2 (only the whole number part) or 2.5) c = a % b (result is 1) (the above might look like c = a mod b) Hope this will help you.


What is an arithmetic operator in c program?

An arithmetic operator is any of the "atomic" operators to do the following math operations: + addition - subtraction / division * multiplication % modulus division


Which operator finds the remainder of integer division?

The modulo (shortened to mod) finds the remainder of the division, while the div function finds integer division. Therefore, because 10 / 3 is equal to 3 remainder 1, 10 mod 3 is equal to 1, the remainder of the sum. In some programming languages this is written as %, for example, in Java or C the result of 10 % 3 would be 1.


Explain the all operator the c language?

Visit this link http://www.cplusplus.com/doc/tutorial/operators/


Use of Percent in C programming?

%p is used in a printf statement to show the memory address value of a pointer. It does not show the address of the pointer itself. You can see this with the following program:#include int main(void){int* p;printf("p: %p x: %x x&: %x\n",p,p,&p);}This gave me the following output:p: 0x33d6d0 x: 33d6d0 x&: bf9a8c10So %p is a way of formatting the value in a pointer to make it obvious that you are referring to a memory location.


What is the difference between forward slash and backward slash in c?

forward slash - division operator backward slash - special character (e.g. \n - newline) in C strings


What are the basic operator in turbo c?

+ += - -= * *= / /= % %= = == != &lt;= &gt;= &amp; &amp;&amp; | ^ ~ &lt;&lt; &lt;&lt;= &gt;&gt; &gt;&gt;= , [] () are the basic operator in TURBO C


What is the operator that cannot be overloaded in c plus plus and java?

conditional operator , size of operator , membership operator and scope resulation operator can not be overload in c++


Use of scope resolution operator in C programming?

:: operator can not be used in C.


What is the memory management operator in c plus plus?

There is no memory management operator in C++ -- it is an unmanaged language. You use the C++ new operator to allocate memory, and use the C++ delete operator to release previously allocated memory.


What are the various operators available in c language?

There are eight types of operators which are used in C language.These are- 1.Arithmetic operator 2.Assignment operator 3.Relational operator 4.Increment/Decrement operator 5.Bitwise operator 6.Logical operator 7.Conditional operator 8.Additional operator 1.Arithmetic operator:Arithmetic operators are mathmetical operator.These are addition,Subtraction,Multiplication and divison. 2.Assignment operator:Assignment operators are used to store the result of an expression to a variable.


Is it possible to do operator overloading in c?

No. Operator and/or function overloading is only a C++ thing.