do...while
2025-07-05 16:18:00
发布于:上海
217阅读
0回复
1点赞
#include<iostream>
using namespace std;
int n;
int main(){
cin >> n;
do{
if (n%2){
cout << n << "*3+1=";
n=n*3+1;
cout << n << endl;
}
else{
cout << n << "/2=";
n/=2;
cout << n << endl;
}
}
while (n>1);
cout << "End" << endl;
return 0;
}
这里空空如也
有帮助,赞一个