#include"stdio.h"
#include"string.h"
#include"conio.h"
#include"windows.h"
#include"math.h"
int f ( int );
int sum ( int );
int main()
{
int a,b;
printf("输入一个整数:");scanf("%d",&a);
b = sum ( a );
printf(" a = %d \t b = %d \n",a,b);
return 0;
}
int sum ( int n )
{
int x;
int s = 0;
for ( x = 0; x <= n; x ++ )
{
s += f ( x );
}
return s;
}
int f ( int z )
{
return z*z+1;
}
请讲解一下答案是怎么算出来的?
产品经理不是经理
相关分类