Created
September 6, 2012 20:12
-
-
Save vertrigo/3660041 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Program ex1; | |
| uses crt; | |
| var x1, x2, y1, y2, d: integer; | |
| begin | |
| ClrScr; | |
| WriteLn( 'Введите через пробел координаты x1, y1, x2, y2' ); | |
| ReadLn( x1, y1, x2, y2 ); | |
| d:= trunc( sqrt( sqr( x1 - x2 ) + sqr( y1 - y2 ) ) ); | |
| WriteLn( 'Целая часть расстояния между точками = ', d); | |
| ReadKey; | |
| end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Program ex2; | |
| uses crt; | |
| var a,b,c:integer; | |
| cosa,cosb,cosc:real; | |
| rb, rs, rz, ao, ap, at:boolean; | |
| begin | |
| ClrScr; | |
| write('введите строну a = '); | |
| readln(a); | |
| write('введите строну b = '); | |
| readln(b); | |
| write('введите строну c = '); | |
| readln(c); | |
| if (c-b-a>=0) or (b-c-a>=0) or (a-b-c>=0) | |
| then | |
| begin | |
| writeln('ТАКОЙ ТРЕУГОЛЬНИК НЕ СУЩЕСТВУЕТ'); | |
| readkey; | |
| exit | |
| end; | |
| cosa:=(sqr(b)+sqr(c)-sqr(a))/(2*b*c); | |
| cosb:=(sqr(a)+sqr(c)-sqr(b))/(2*a*c); | |
| cosc:=(sqr(a)+sqr(b)-sqr(c))/(2*a*b); | |
| writeln; | |
| if (a-b=0) and (c-0=a) then rs:=true; | |
| if ((a-b=0) and (c-0-a<>0)) or ((a-c=0) and (b-0-a<>0)) or ((c-b=0) and (a-0-c<>0)) then rb:=true; | |
| if (a<>b) and (a<>c) and (b<>c) then rz:=true; | |
| if (cosa>0) and (cosb>0) and (cosc>0) then ao:=true; | |
| if (cosa=0) or (cosb=0) or (cosc=0) then ap:=true; | |
| if (cosa<0) or (cosb<0) or (cosc<0) then at:=true; | |
| if (rs) then writeln('Треугольник равносторонний'); | |
| if (rb) then writeln('Треугольник равнобедренный'); | |
| if (rz) then writeln('Треугольник разносторонний'); | |
| if (ao) then writeln('Треугольник остроугольный'); | |
| if (ap) then writeln('Треугольник прямоугольный'); | |
| if (at) then writeln('Треугольник тупоугольный'); | |
| Readkey; | |
| end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Program ex3; | |
| uses crt; | |
| var a1,a2,b:real; i:integer; | |
| Begin | |
| clrscr; | |
| writeln('Введите вещественное положительное число:'); | |
| readln (b); | |
| if b>0 then begin | |
| a1:=b; | |
| i:=2; | |
| while a1>0 do begin | |
| a2:=a1-(1/sqrt(i)); | |
| a1:=a2; | |
| i:=i+1; | |
| end; | |
| writeln(a1:4:4,'-первый отрицательный член последовательности.'); | |
| end | |
| else | |
| writeln ('Неверный ввод!'); | |
| Readkey; | |
| End. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Program ex4; | |
| uses crt; | |
| const n_max=10; | |
| type mas=array [1..n_max] of integer; | |
| procedure Input (var x,y:mas; var n:integer); | |
| var i:integer; | |
| begin | |
| write('Введите кол-во вершин многоугольника: '); | |
| readln(n); | |
| while n>n_max do | |
| begin | |
| writeln('Ошибка! Повторите ввод!'); | |
| readln(n); | |
| end; | |
| for i:=1 to n do | |
| begin | |
| writeln('Введите координаты ',i,'-й вершины(x,y)'); | |
| readln(x[i],y[i]); | |
| writeln; | |
| end; | |
| end; | |
| var | |
| x,y:mas; | |
| i,j,n:integer; | |
| d_max,d:real; | |
| begin | |
| ClrScr; | |
| Input(x,y,n); | |
| d_max:=0; | |
| for i:=1 to n-2 do | |
| begin | |
| for j:=1 to n do | |
| begin | |
| if ((j-i)>=2) and ((j-i)<(n-1)) then | |
| begin | |
| d:=sqrt(sqr(x[j]-x[i])+sqr(y[j]-y[i])); | |
| if d>d_max then d_max:=d; | |
| end; | |
| end; | |
| end; | |
| writeln('Самая длинная диагональ: ',d_max:2:1); | |
| ReadKey; | |
| end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment