#include<iostream>
using namespace std;
int Fun(unsigned int n){
if(n==1)
return 1;
else
return Fun(n-1)+n;
}
int main(){
unsigned int n;
cout<<"input the number of the Num:";
cin>>n;
cout<<Fun(n)<<endl;
return 0;
}
递归法求三角形数(1,3,6,10,15...)
最新推荐文章于 2020-12-16 15:15:43 发布