tijie
2025-01-11 16:09:04
发布于:浙江
0阅读
0回复
0点赞
应该不难吧?
#include <iostream>
using namespace std;
int main(){
int a;
cin >> a;
while(a!=1){
if(a%2==0){
cout << a << "/2=";
a/=2;
cout << a << endl;
}else{
cout << a << "*3+1=";
a=a*3+1;
cout << a << endl;
}
}
cout << "End";
return 0;
}
这里空空如也
有帮助,赞一个