
Call 1800-123-2003
"Smartindia is the best online tool for school students." Ms Deepa Chandran, Principal Anchal
"Smartindia is one of the best supplementary education tool for school students." Ms Pooja, Principal
What is difference between ‘/’ and ‘%’ operators in c++ ? Explain with a example. |
Mathematical operators are used to perform basic mathematical operations. Addition(+), subtraction(-), diversion(/), multiplication(*) and modulus(%) are the basic mathematical operators. Modulus operators cannot be used with floating-point number. '/ ' Divides numerator by the de-numerator . Example : Assume variable A holds 10 and variable B holds 20 then, B / A will give 2 ' % ' Modulus operator and remainder of after an integer division. Example : Assume variable A holds 10 and variable B holds 20 then, B % A will give 0 |