#include #include #include int main(int argc, char *argv[]) { double y,x,xd,a,b,i,sr,sum,maks,licznik=1,eps=0.00001; printf("Podaj xp\n"); scanf("%lf",&a); printf("Podaj xk\n"); scanf("%lf",&b); printf("Podaj xd\n"); scanf("%lf",&xd); if(xd<0) { printf("xd musi byc wieksze od 0\n"); }else { x=a; if(x<0-eps) { y=pow(x,3)+(1.0/x); }else { if(x>0-eps && x<0+eps) { y=3*(sqrt(2)); }else { y=pow(sin(sqrt(x)),1.0/3.0); } } printf("Y=%lf\n",y); maks=y; sum=sum+y; for(i=a+xd;i<=b;i=i+xd) { x=i; if(x<0-eps) { y=pow(x,3)+(1.0/x); }else { if(x>0-eps && x<0+eps) { y=3*(sqrt(2)); }else { y=pow(sin(sqrt(x)),(1.0)/3); } } printf("Y=%lf\n",y); licznik++; sum=sum+y; if(y>maks) { maks=y; } } sr=sum/licznik; printf("Srednia:%lf\n",sr); printf("Maks:%lf",maks); } return 0; }