Skip to content

Instantly share code, notes, and snippets.

@jasarsoft
Last active October 7, 2016 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasarsoft/f1669097fcff3d8f302b7b5da6ba71d4 to your computer and use it in GitHub Desktop.
Save jasarsoft/f1669097fcff3d8f302b7b5da6ba71d4 to your computer and use it in GitHub Desktop.
The school example of calculating the average score using the Pascal
{*******************************************************************}
{ }
{ Borland Turbo Pascal 1.5 for Windows }
{ Thursday, 9. December 2010 }
{ Copyright(c) by Edin Jašarević }
{ edinjasar14@gmail.com }
{ }
{*******************************************************************}
Program CoculateAvarage (Input, OutPut);
Uses WinCrt;
Const NUMBER_SUBJECT=16;
Type mark=array[1..NUMBER_SUBJECT] Of Integer;
Var rating:mark;
i, sum:Integer;
avarage:Real;
Begin
For i:=1 To NUMBER_SUBJECT Do Begin
Write ('Rating: ');
Readln (rating[i]);
sum:=0;
i:=1;
While i<=NUMBER_SUBJECT Do Begin
sum:=sum+rating[i];
i:=i+1;
end
end;
avarage :=sum/NUMBER_SUBJECT;
Writeln ('Avarage: ',avarage:6:2);
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment