Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program l3e1evm;
- {Ivan Ryvonenko, PM-12}
- {compute value of function f for arguments x:a<=x<=b with step h }
- {using functions and procedures}
- uses crt;
- var
- a,b,h,x,f:real;
- function sum:integer;
- var
- s,i:integer;
- begin
- s:=0;
- for i:=1 to 12 do
- s:=s+sqr(i-2);
- sum:=s;
- end;
- function compute_func(x:real):real;
- begin
- if x<1 then
- compute_func:=x*x*x-3*x+x*x
- else if x<=5 then
- compute_func:=(x*x+10-x)/(1+x)+sum
- else
- compute_func:=sqrt(sqr(x*x+1)+5);
- end;
- begin
- clrscr;
- writeln;
- writeln(sum);
- write ('Enter [a,b] -> ');
- readln(a,b);
- write('Enter step h -> ');
- readln(h);
- writeln('Table of function values');
- writeln('_______________________');
- writeln('|x |f |' );
- writeln('_______________________');
- x:=a;
- while (x<=b) do
- begin
- f:=compute_func(x);
- writeln('|',x:6:2,'|',f:11:4,'|');
- x:=x+h;
- end;
- writeln('_______________________');
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement