25) program Funct;
uses crt;
Var D,A,B,x,y,C:real;
function P(n:real):real;
begin P:= exp(1/3*ln(n)); end; begin
clrscr; write('x = '); readln(x); write('y = '); readln(y);
A:= P(x)+ P(y); writeln('A = ',A); readln; end.
26) Program Vera;
Uses crt;
var x,y,z,s,r:real; n,i,j:integer; b:boolean;
begin Clrscr;
write('enter x: '); readln(x); writeln(x); write('enter n: '); readln(n); writeln(n);
s := 0; b := false; if (not odd(n)) then n := n + 1; i := 1; while i <= n do begin y := x; z := 1; j := 1; while j < i do
begin y := y*x; j := j + 1; z := z*j; end;
if b = true then s := s-y/z else s := s+y/z; b := not b; i := i + 2;
r := sin(s); end; writeln(r); readln; end.
27) program piram;
uses crt;
var j,i:integer;
begin
clrscr;
for i:=1 to 25 do begin gotoxy(40-i,i); for j:=2 to 2*i do
write('*'); end; end.
28 ) Program Cylinder;
Uses Crt; Var R, H, V, S: Real;
BEGIN ClrScr;
ReadLn(H); ReadLn(R);
V := Pi * R * R * H; S := 2 * Pi * R * H; WriteLn;
WriteLn( S : 5 : 2); ReadLn END.
29) Program Points;
Uses Crt;
Var xA, yA, xB, yB, xC, yC, DistA, DistB, DistC : Real;
BEGIN ClrScr; Write('x = '); ReadLn(xA);
Write('y = '); ReadLn(yA); Write('x = '); ReadLn(xB);
Write('y = '); ReadLn(yB); Write('x = '); ReadLn(xC);
Write('y = '); ReadLn(yC); DistA := sqrt(sqr(xA) + sqr(yA));
DistB := sqrt(sqr(xB) + sqr(yB)); DistC := sqrt(sqr(xC) + sqr(yC));
If ( DistA < DistB) and (DistA < DistC) then WriteLn( a)
else If (DistB < DistC) then WriteLn( B) else WriteLn( C);
ReadLn END.
30) Program Quadratic;
Uses Crt; Var a, b, c : Real;
Discr : Real; x1, x2 : Real; Test, NTest : Integer;
EGIN ClrScr;
ReadLn(NTest); For Test := 1 to NTest do begin
ReadLn(a, b, c); begin Discr := b*b - 4*a*c;
If Discr > 0 then begin x1:=(-b + Sqrt(Discr)) / (2*a); x2:=(-b - Sqrt(Discr)) / (2*a); WriteLn('x1=' , x1:6:2 , '; x2=' , x2:6:2) end else if Discr = 0 then begin x1 := -b/(2*a); WriteLn(`x1=', x1:6:2, ' x2=', x1:6:2) end else WriteLn('natija yo`q'); end; WriteLn end; ReadLn END.
Dostları ilə paylaş: |