Advertisement
Guest User

Lab_1_1

a guest
Sep 17th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.86 KB | None | 0 0
  1. program lab1_1;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6.   System.SysUtils;
  7.  
  8. var
  9.   first, second, third: double;
  10.   isCorrect: boolean;
  11.  
  12. begin
  13.   isCorrect := false ;
  14.  
  15.   repeat
  16.     try
  17.       writeln('Enter the length of the first segment:');
  18.       readln(first);
  19.       writeln('Enter the length of the second segment:');
  20.       readln(second);
  21.       writeln('Enter the length of the third segment:');
  22.       readln(third);
  23.       isCorrect := true;
  24.         if (first <= 0) or (second <= 0) or (third <= 0) then
  25.         begin
  26.           writeln('The length must be greater than 0!');
  27.           isCorrect := false;
  28.         end;
  29.     except
  30.       writeln('Try again!');
  31.     end;
  32.   until isCorrect;
  33.  
  34.   if (first + second > third) and (first + third > second) and (second + third > first) then
  35.     writeln('Possible.')
  36.   else
  37.     writeln('Impossible.');
  38.   readln;
  39. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement