0% found this document useful (0 votes)
6 views5 pages

Pascal

The document contains a series of Pascal programs that demonstrate basic programming concepts such as input/output, arithmetic operations, conditional statements, and variable handling. Each program serves a specific function, such as calculating hours, discounts, or total bills based on user input. The examples illustrate fundamental programming structures and logic in Pascal.

Uploaded by

Miriam Salim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Pascal

The document contains a series of Pascal programs that demonstrate basic programming concepts such as input/output, arithmetic operations, conditional statements, and variable handling. Each program serves a specific function, such as calculating hours, discounts, or total bills based on user input. The examples illustrate fundamental programming structures and logic in Pascal.

Uploaded by

Miriam Salim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Pascal

1. Program Hello;

begin

Writeln (‘Today is Monday’);

End.

2. Program Number;

var num1: integer;

begin

Writeln (‘Please enter a number’);


readln (num1);
Writeln (‘The number you entered is’ num1);

End.

3. Program Grocery;

var item: string, price: real;

begin

Writeln (‘Please enter the item and price’);


readln (item, price);
Writeln (‘The item and price you entered are’, item, price);

End.
4. Program Month;

var days, hrs: integer;

begin

Writeln (‘Please enter the no. of days in a month’);


readln (days);
hrs:= days * 24;
Writeln (‘The number of hours in this month is’, hrs);

End.

5. Program Bill;

var price, total: real, qty: integer;

begin

Writeln (‘Please enter the price and quantity of the item’);


readln (price, qty);
total:= price * qty;
Writeln (‘Your total bill is $’ total);

End.

6. Program Employee;

var hrs: integer, pay, Salary: real;

begin

Writeln (‘Please enter the no. of hours and rate of pay’);


readln (hrs, pay);
Salary:= hrs * pay;
Writeln (‘Your salary is $’ Salary);

End.
7. Program Discount;

var price, dp: real;

begin

Writeln (‘Please enter the price of an item’);


readln (price);
dp:= price * 0.85;
Writeln (‘Your discounted price is’ dp);

End.

8. Program Grade;

var mark: integer;

begin

Writeln (‘Please enter a mark’);


readln (mark);
If mark > 50 then
begin
Writeln (‘Pass’);
end;

End.

9. Program Number

var N: integer;

begin

Writeln (‘Please enter a number’);


readln (N);
If N > 100 then
begin
N:= N + 10;
Writeln (‘The new number is’ N);
end;

End.
10. Program Discount

var price, dp: real;

begin

Writeln (‘Please input the price’);


readln (price);
If price >= 500 then
begin
dp:= price – 100;
Writeln (‘Your discounted price is’ dp);
end;

End.

11. Program Higher;

var A,B: integer;

begin

Writeln (‘Please enter two values’);


readln (A,B);
If A>B then
begin
Writeln (‘The higher value is’ A);
Else
Writeln (‘The higher value is’ B);
end;

End.
12. Program Discount;

var price, dp, Bill: real, qty: integer;

begin

Writeln (‘Please enter the price and quantity of an item purchased’);


readln (price, qty);
Bill:= price * qty;
If Bill > 1 000
begin
dp:= 0.9 * Bill;
Writeln (‘Your discounted price is $’ dp);
Else
Writeln (‘Your bill is $’ Bill);
end;

End.

13. Program Employee;

var hrs: integer, pay, salary: real;

begin

Writeln (‘Please enter the number of hours you work and your rate of pay’);
readln (hrs, pay);
Salary:= hrs * pay;
If hrs > 40 then
begin
salary:= hrs * pay * 2;
Writeln (‘Your salary is $’ salary);
Else
Writeln (‘Your salary is $’ salary);
end;

End.

You might also like