0% found this document useful (0 votes)
58 views2 pages

Program P1 Var A: Begin: Writeln Readln (A) Writeln (,a-) Writeln (,a) Readln

The document contains 4 Pascal programs (p1, p2, p3, p4) that use conditional statements. Program p1 prints if a number input by the user is positive or negative. Program p2 is similar but adds 6 to a negative number. Program p3 handles the case when the number is 0 separately from positive and negative cases. Program p4 compares two input numbers and prints the larger.

Uploaded by

Sergiu Bejan
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)
58 views2 pages

Program P1 Var A: Begin: Writeln Readln (A) Writeln (,a-) Writeln (,a) Readln

The document contains 4 Pascal programs (p1, p2, p3, p4) that use conditional statements. Program p1 prints if a number input by the user is positive or negative. Program p2 is similar but adds 6 to a negative number. Program p3 handles the case when the number is 0 separately from positive and negative cases. Program p4 compares two input numbers and prints the larger.

Uploaded by

Sergiu Bejan
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/ 2

IF

{if}
PROGRAM p1;
var a:real;
begin
Writeln('introdu un numar');
Readln(a);
if a>0 then
writeln('numarul este pozitiv si micsorat cu 8 este=',a-8)
else
Writeln('numarul este negativ ',a);
readln;
end.
{if}
PROGRAM p2;
var a:real;
begin
Writeln('introdu un numar');
Readln(a);
if a>0 then
writeln('numarul este pozitiv si micsorat cu 8 este=',a-8)
else
Writeln('numarul este negativ ',a+6);
readln;
end.
{if}
PROGRAM p3;
var a:real;
begin
Writeln('introdu un numar');
Readln(a);
if a=0 then Writeln(a+10) else
if a>0 then
writeln('numarul este pozitiv si micsorat cu 8 este=',a-8)
else
Writeln('numarul este negativ ',a+6);
readln;
end.
{if}
PROGRAM p4;
var
a,b: real;
begin
readln(a,b);
if a>b then Writeln('numerulmai mare este',a)
else Writeln('numerulmai mare este',b);
end.

CASE

FOR
WHILE

You might also like