Pascal: Area and Circumference of a Circle

program ex12;

const pi=3.14159;

var radius, area, circumference: real;

begin
  writeln ('Enter a value for the radius of a circle');
  readln (radius);
  circumference:= 2 * pi * radius;
  area:=pi * radius * radius;
  writeln ('Area  of circle is: ', area: 8:2);
  writeln ('Circumference of circle is: ', circumference:8:2);
  readln;
end.

Constants retain their value for the duration of a program. Constants are defined before variables.

Back to questions