Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program trikampis_bendrai;
- uses crt;
- var a, b, c : integer;
- r : char;
- label start;
- begin
- start:ClrScr;
- a := 0;
- b := 0;
- c := 0;
- repeat //kartojam kol yra nuliniu reiksmiu
- ClrScr;
- TextColor (white);
- GotoXY (2,2);
- Write ('Ivesk trikampio krastines, atskirtas tarpais: ');
- Read (a, b, c);
- if (a > 0) and (b > 0) and (c > 0) then //tikrinam ar yra nuliniu reiksmiu
- begin
- GotoXY (2,3);
- Write ('Neteisingos reiksmes!');
- Delay (2000);
- end;
- { Repeat
- ClrScr;
- GotoXY (2,2);
- Write ('Ivesk trikampio krastines, atskirtas tarpais: ');
- Read (a, b, c); }
- until (a >= 1) or (b >= 1) or (c >= 1); //kai nebera nuliniu reiksmiu pradedam likusia daly
- //end
- //else
- //begin
- if (a + b > c ) and (a + c > b) and (b + c > a) then //jaigu dvieju atkarpu suma didesne uz treciaja tai
- begin
- GotoXY (3,4);
- TextColor (green);
- Write ('Trikampty sudaryti galima!');
- end
- else
- begin
- GotoXY (3,4);
- TextColor (red);
- Write ('Trikampy sudaryti negalima!');
- end;
- GotoXY (2,5);
- Write ('Kartoti?: ');
- Read (r);
- r := readkey;
- Case r of
- 't' : Goto Start;
- 'n' : halt;
- end;
- //end;
- end.
Add Comment
Please, Sign In to add comment