啊?*2
2024-06-05 21:43:18
发布于:浙江
4阅读
0回复
0点赞
#include <iostream>
using namespace std;
int main() {
int num;
cin >> num;
if (num == 1) {
cout << "End" << endl;
return 0;
}
while (num != 1) {
cout << num << (num % 2 ? "*3+1=" : "/2=");
num = num % 2 ? num * 3 + 1 : num / 2;
cout << num << endl;
}
cout << "End" << endl;
return 0;
}
这里空空如也
有帮助,赞一个