学习目标:
用C++编写简单的题目
学习内容:
#include<iostream>
using namespace std;
int main(){
long long n;
cin>>n;
while(n!=1){
if(n%2==1){
cout<<n<<"*3+1="<<n*3+1<<endl;
n=3*n+1;
}
else{
cout<<n<<"/2="<<n/2<<endl;
n=n/2;
}
}
cout<<"End";
return 0;
}
标签:角谷,题目,cout,int,编程,n%,long,C++
From: https://blog.csdn.net/OCEANCITY/article/details/140108042