#include <stdio.h>
#include <stdlib.h>
#include <math.h>
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;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}