Рассчитать значение функции y=5x^2+x^2-7x-30 для значений аргумента 0; 1; 1,5; 6; -4
program функция;
var a, b, c, d, e, x1, y1: real;
procedure fun (var x, y: real) ;
begin
y1 : =5*x*sqr(x)+sqr(x) - 7*x-30;
end;
begin
read (a, b, c, d, e);
fun (a, y1) ;
write (y1) ;
fun (b, y1) ;
write (y1) ;
fun (c, y1) ;
write (y1) ;
fun (d; y1) ;
write (y1) ;
fun (e, y1) ;
write (y1) ;
end.
заранее !
var a,b,c,d,e,f,r,x,y,z:real;
begin
writeln('d, e, f:');
readln(d,e,f);
write('r = ');
readln(r);
x:=d*pi/180;
y:=e*pi/180;
z:=f*pi/180;
a:=2*r*sin(x);
b:=2*r*sin(y);
c:=2*r*sin(z);
writeln('a = ',a:5:2,' b = ',b:5:2,' c = ',c:5:2);
end.
Пример:
d, e, f:
90 60 30
r = 2.5
a = 5.00 b = 4.33 c = 2.50
2)
var a,b,c,d:integer;
begin
writeln('a, b, c, d:');
readln(a,b,c,d);
if a+c>150
then writeln('a+c = ',a+c,' a = ',a,' b = ',b,' c = ',c,' d = ',d);
end.
Пример:
a, b, c, d:
72 18 94 25
a+c = 166 a = 72 b = 18 c = 94 d = 25
program zadagha_1;
var
a: array[1..8] of integer;
i,sum:integer;
begin
writeln('vvedite 8 chisel');
for i:=1 to 8 do read(a[i]);
sum:=0;
for i:=1 to 8 do begin
if i mod 2 <> 0 then begin
sum:=sum+a[i];
writeln(a[i]);
end;
end;
writeln();
writeln('summa elementov c nechetnim N =', sum);
end.
program zadagha_2;
var
b: array[1..1000] of integer;
i,a,n:integer;
begin
writeln('vvedite chislo - kolichestvo elementov massiva');
readln(n);
for i:=1 to n do begin
b[i]:=random(1000);
write(b[i]:6);
end;
writeln();
writeln('vvedite chislo');
readln(a);
write ('elementi > dannogo chisla: ');
for i:=1 to n do begin
if b[i]>a then write (i:4);
end;
end.
program zadacha_3;
var
a: array[1..100] of integer;
i,n,k: integer;
begin
n:=random(100);
for i:=1 to n do begin
a[i]:=random(1000)-500;
write(a[i]:6);
end;
writeln();
writeln('vvedite chislo');
readln(k);
writeln('v massive chisly ',k, ' kratni: ');
for i:=1 to n do begin
if (a[i] mod k = 0) and (a[i]>0) then begin
write(a[i]:6);
end;
end;
end.