c语言取模数和取余数运算
Given two integer numbers and we have to find the remainder without using modulus operator (%) in C.
给定两个整数,我们必须在C中不使用模数运算符(%)的情况下找到余数。
Here, we will read two integers numbers and find their remainder. To get the remainder we will not use the modulus (%) operator.
在这里,我们将读取两个整数并找到它们的余数。 为了得到余数,我们将不使用模数(%)运算符。
求余数的公式, (Formulas to get the remainder,)
1) Using modulus (%) operator
1)使用模数(%)运算符
rem = a%b;
2) Without using modulus (%) operator
2)不使用模数(%)运算符
rem = a-(a/b)*b;
Here, a