1,有3个变量名为a、b和c
begin
real a,b,c;
a:=535.43;
b:=289.771;
c:=a×b;
print ('The product of', a,'and', b, ' is ', c);
end
2,如果想乘另外两个数,则需要修改程序,改变数,重新编译,再运行。可以利用一个名为read的内置函数来避免这种频繁的重新编译工作:
begin
real a,b,c;
print ('Enter the first number: ');
read (a);
print ('Enter the second number: ');
read (b);
c:= a×b;
print ('The product ', a, ' and ', b, ' is ', c);
end