| 123456789101112131415161718192021222324252627282930313233 |
- PROGRAM PROG6;
- {$U+ Copyright (C), 1985 by Lyle Faurot. All rights reserved.
- New Topics: IF statement
- Conditions used with IF
- }
- VAR
- Have, Want : Integer;
- BEGIN
- Write('How many computers do you own? ');
- ReadLn(Have);
- Write('How many computers would you like? ');
- ReadLn(Want);
- WriteLn;
- If Have = 0 {One-way IF .. THEN }
- THEN
- WriteLn('No computer! Give me a call at 123-4567.');
- If Have >= Want {Two-way IF .. THEN .. ELSE }
- THEN
- WriteLn('Congratulations! Happy Computing!')
- ELSE
- WriteLn('Sorry about that!');
- If (Want - Have) > 2 {Integer expression as part of condition }
- THEN
- WriteLn('(Aren''t you a little greedy?)');
- END.
|