Pascal program to find the average of numbers using WHILE DO structure

To calculate the sum and average of three different numbers. You can edit the loop and the average formula to repeat it as many times as you'd like.

Program untitled;
var
sum, ave, n : real;
i : integer;
begin
sum := 0;
i := 1;
while i <=3 do
begin
writeln ('enter your numbers');
readln (n);
sum := sum + n;
ave := sum / 3;
i := i + 1 ;
end;
writeln (ave);
readln;
end.


Do you like this post? Please link back to this article by copying one of the codes below.

URL Of Post:


HTML Link Code:

BB (forum) link code:

Share on Google Plus

About Grace Joseph

Grace Joseph is an educational and tech blogger. Other than having passion for gadgets and generally the tech niche, she's a writer at heart and reading is forever a hobby.

0 comments:

Post a Comment