Question:

I am to write a comparison program that outputs true mathematical statements. Ask the user for two numbers, and then output one of the following statements
number1>number2
number1<number2
or number1=number2

The user must also be able to keep running the program with different numbers, when they have finished running the program, thank them and tell them how many times they ran the program.

``````program Project1;

{\$APPTYPE CONSOLE}

uses
SysUtils;

var
a, b: integer;
count : integer;

begin
for count:=1 to 3 do
begin
if a>b then begin
writeln (a,' is greater than ', b);
end
else
begin
if a=b then
begin
writeln (a,' is equal to ', b);
end
else
if b>a then
begin
writeln (b,' is greater than ', a);

end;

end;

writeln ('Would you like to run this program again?');

end;
writeln ('Thank you for your running this program.');

end.
``````

But I am sure that my answer has some missing: thank them and tell them how many times they ran the program.

Cheers,

:)

``````Program Program01;

Var a,b:Integer;{-32767..32768}
Count:Integer;
answer:Char;{0..255 characters from the ASCII table}

Begin {main}
Count:=0;
Begin

If (a>b) Then
Begin
WriteLn(a,' is greater than ', b);
End;{if a>b}
If (a=b) Then
Begin
WriteLn(a,' is equal to ', b);
End;{if a=b}
If (b>a) then
Begin
WriteLn(b,' is greater than ', a);
End;{if b>a}
WriteLn;

WriteLn('Would you like to run this program again?Y or N');

End;{of case}
Count:=Count+1;
End;{of while}

WriteLn('Thank you for your running this program.');
Write('Total Run: ',Count);

End.{of main program}

{
-= Note By FlamingClaw =-
A bit  I rewrote your program for prefect working,sorry
All programs created by me are written and tested
in Dev Pascal and/or Turbo Pascal 7.0
working...
-= Created By FlamingClaw =-
-=2009.03.26=-
}``````
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.