xt4-11.cpp
来自「谭浩强c++. 给需要的人用。希望大家满意。」· C++ 代码 · 共 22 行
CPP
22 行
#include <iostream>
using namespace std;
int main()
{int f(int);
int n,s;
cout<<"input the number n:";
cin>>n;
s=f(n);
cout<<"The result is "<<s<<endl;
return 0;
}
int f(int n)
{;
if (n==1)
return 1;
else
return (n*n+f(n-1));
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?