c语言编程求阴影部分的面积的近似值(和n有关)

Python021

c语言编程求阴影部分的面积的近似值(和n有关),第1张

n在哪里?怎么个有关法?阴影部分的面积不就是(x-1)^2+1在[1,2]上积分吗?

#include "stdio.h"

int main(int argc,char *argv[]){

double s,x,t

for(t=1.0E-6,s=x=0x<=2s+=((x-1)*(x-1)+1)*t,x+=t)

printf("s≈%g\n",s) 

return 0

}

#include<stdio.h>

#define PI 3.14159

int main() 

{

   int a,n

   float s

   scanf("%d%d",&a,&n)

   s=(a*a-PI*a*a/4)*n*n

   printf("%.2f",s)       

}  

不懂可问