Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program Lab1;
- Uses
- System.SysUtils;
- Var
- Gen : Char;
- Age, ReAge : Integer;
- IsCorrect : Boolean;
- Begin
- Writeln( 'This program will find the recommended age for marriage' );
- Writeln( 'Man or Woman ? ENTER M if you are a man or W if you are a woman and your age.' );
- Repeat
- IsCorrect := True;
- Try
- Readln(Gen, Age);
- If ( Gen <> 'M' ) And ( Gen <> 'W' ) Then
- Begin
- Writeln( 'Enter existing gender' );
- IsCorrect := False;
- End;
- If ( Age < 16 ) Or ( Age > 100 ) Then
- Begin
- Writeln( 'Enter acceptable age(16-100)' );
- IsCorrect := False;
- End;
- Except
- Writeln( 'Data entered incorrectly, please re-enter' );
- IsCorrect := False;
- End;
- Until (IsCorrect);
- If ( Gen = 'M' ) Then
- ReAge := Age Div 2 + 7
- Else
- ReAGe := Age * 2 - 14;
- Writeln( 'Recommended age of a candidate for marriage : ', ReAge );
- Readln;
- End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement