Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

G.C.E. (O.

level)
Grade 11
Information and Communication Technology
Pascal Programs

Download turbo pascal to your computer


 Try run these programs & write down the output
Program 01-Simple output
program output1;
begin
write('Infromation ');
write('communication ');
writeln('technology');
readln;
end.

Program 02 - Mathematical operators


program MathOpp;
begin
writeln('6+4 = ',6+4);
writeln('7-5 = ',7-5);
writeln('2*8 = ',2*8);
writeln('10/4 = ',10/4);
writeln('20 DIV 6 = ',20 DIV 6);
writeln('20 MOD 6 = ',20 MOD 6);
readln;
end.

Program 0 3- Comparison operators


program compOpp;
begin

1
writeln('6>4 is : ',6>4);
writeln('7<=5 is : ',7<=5);
writeln('2=4 is : ',10>=4);
writeln('20 = 6 is : ',20 = 6);
writeln('5 = 5 is : ',5 = 5);
writeln('20 <> 6 is : ',20 <> 6);
writeln('5 <> 5 is : ',5 <> 5);
readln;
end.

Program 04 - Logical operators


program compOpp;
begin
writeln('6>4 AND 3>2 is : ',(6>4) AND (3>2));
writeln('7<=5 AND 8>4 is : ',(7<=5) AND (8>4));
writeln('2<8OR 8<5 is : ', (2<8 OR (8<5));
writeln('1>=4 OR 3<2is : ',(1>=4) OR (3<2));
writeln('NOT (20 = 6) is : ',NOT (20 = 6));
writeln('NOT (6 = 6) : ',NOT (6 = 6));
readln;
end.

 Consider the following problems


1. Draw a flow chart
2. Write pseudo code ,
3. Write pascal programs for each problem

Program 05 - Find total & Average of given 2 numbers


Program 06 - If the input number is only positive, Print the number
Program 07 - Display net bill value after deduction of discount

2
Bill value(n) – above 5000 – Discount(d) = n*0.1
Bill value(n) – equal or below 5000 – Discount(d) = n*0.0.5
Display bill value,discount,payable price
Program 08 - Display multiplication table of 8 (8 x 1 = 8)
Program 09 - calculate even numbers between 0 and 99
An algorithm
1. Start
2. I ← 0
3. Write I in standard output
4. I ← I+2
5. If (I <=98) then go to line 3
6. End

 Try to run following programs


Program 10 - For do program
program fordo;
Var count : integer;
begin
For count := 1 to 10 do
write(count,', ');
readln;
end.
Program 10 - For Down to do program
program forDown;
Var count : integer;
begin
For count := 10 downto 1 do
write(count,', ');
readln;
end.

3
Program 12 - While do program
program whiledo;
Var count : integer;
begin
count:=1;
while count<=10 do
begin
write(count,', ');
count:=count+1;
end;
readln;
end.
Program 13 Repeat until program
program whiledo;
Var count : integer;
begin
count:=0;
repeat
count:=count+5;
write(count,', ');
until count >= 50;
readln;
end.

You might also like