Advertisement
LisunovaMaryna

lab1.1 delphi

Sep 25th, 2023 (edited)
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.29 KB | None | 0 0
  1. Program Lab;
  2.  
  3. Var
  4.     Radius, Side: Integer;
  5.     IsCorrect: Boolean;
  6.  
  7. Begin
  8.     Writeln('The program will determine whether the circle fits into the square.');
  9.     Write('Enter radius:  ');
  10.     Repeat
  11.         Try
  12.             IsCorrect := True;
  13.             Read(Radius);
  14.             If (Radius < 0) Or (Radius = 0) Then
  15.             Begin
  16.                 IsCorrect := False;
  17.                 Write('A negative value or zero was entered. Enter a valid value: ');
  18.             End;
  19.         Except
  20.             Begin
  21.                 Write('Symbols have been entered. Enter the number: ');
  22.                 IsCorrect := False;
  23.             End;
  24.          End;
  25.     Until IsCorrect;
  26.     Write('Enter side: ');
  27.     Repeat
  28.         Try
  29.             IsCorrect := True;
  30.             Read(Side);
  31.             If (Side < 0) Or (Side = 0) Then
  32.             Begin
  33.                 IsCorrect := False;
  34.                 Write('A negative value or zero was entered. Enter a valid value: ');
  35.             End;
  36.         Except
  37.             Begin
  38.                 Write('Symbols have been entered. Enter the number: ');
  39.                 IsCorrect := False;
  40.             End;
  41.          End;
  42.     Until IsCorrect;
  43.     If (Radius * 2) < Side Then
  44.         Writeln('Fit in.')
  45.     Else
  46.         Writeln('Not fit in.');
  47. End.
Tags: delphi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement