Intro To Pascal Programming
Intro To Pascal Programming
• READLN(Name of Variable);
For Example:
• READLN(Price);
Basic Syntax cont’d
• Begin with the keyword PROGRAM
• Give the program a name example: PROGRAM
INVENTORY;
• Replace your as with colons (:)
• Use VAR instead of Variable or Declare
• Use CONST instead of Constants
• All statements end with a semi-colon (;)
• All Prompt Statements should have quotations
▫ For Example:
WRITELN( ‘Enter the quantity’)
VAR
Totalprice, price: REAL;
quantity: INTEGER;
BEGIN
WRITELN(‘This program will accept the price and quantity and
find and print the total’);
WRITELN(‘Enter the price’);
READLN(price);
WRITELN(‘Enter the quantity’);
READLN (quantity);
Totalprice:=price*quantity;
WRITELN(‘The total price is’, Totalprice);
Readln();
END.
Activity
Write a Pascal program to find the area of a
rectangle .