1、用 C 语言编程实现一种迭代版本的简单乘法。
#include<iostream>
using namespace std;
int main() {
int a, b; int c=0;
cout << "请输入两个整数:";
cin >> a >> b;
while (b != 0) {
if (b & 1 == 1) {
c += a;
}
b >>= 1;
a <<= 1;
}
cout << "结果为:" << c << endl;
system("pause");
return 0;
}
2、证明命题1.1。
①由,得b=x*a
由,得c=y*b
将b=x*a代入得c=x*