Advertisement
LisunovaMaryna

lab1.3 delphi

Sep 30th, 2023
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.84 KB | None | 0 0
  1. Program Lab;
  2.  
  3. Uses
  4.     System.SysUtils;
  5.  
  6. Var
  7.     NumM, NumK, Num: Integer;
  8.     IsCorrect: Boolean;
  9.  
  10. Begin
  11.     Num := 4;
  12.     Writeln('Given an integer m > 10. Find the largest integer k for which 4^k <
  13.             m.');
  14.     Write('Enter an integer (>10): ');
  15.     Repeat
  16.         Try
  17.             IsCorrect := True;
  18.             Read(NumM);
  19.             If (NumM < 10) Then
  20.             Begin
  21.                 IsCorrect := False;
  22.                 Write('A value less than ten was entered. Enter a valid value: ');
  23.             End;
  24.         Except
  25.             Begin
  26.                 Write('Symbols have been entered. Enter the number: ');
  27.                 IsCorrect := False;
  28.             End;
  29.          End;
  30.     Until IsCorrect;
  31.     While Num < NumM Do
  32.     Begin
  33.         Num := Num * 4;
  34.         Inc(NumK);
  35.     End;
  36.     Write(NumK);
  37. End.
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement