编程中用到的计算方法
整理一些不知道的计算方法
不使用除号计算除法(整数)
void f(int a, int b) {
int quotient, remainder;
quotient = 0;
while (a > b) {
quotient++;
a -= b;
}
remainder = a;
printf("%d, %d", quotient, remainder);
}
取得数字各位的值的加和
```c while(x > 0) { y += x % 10; x /= 10; }