![]() |
|
|
|
| ||||||
|
Welcome to the The ProgrammersTalk Community forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| Tags: |
![]() |
![]() | | LinkBack | Thread Tools | Display Modes | ![]() |
| |||
| [SOLVED] in Pascal programming Language , here is a Question Design a simple pascal programme to compile the average of A question in pascal programming Language here is a Question. Design a simple pascal programm to compile the averaage of Students computing. WHIL---DO Struture. number of Student in Class population 99 please me solved this |
| |
| |||
| Try this: Program Averages; Var Counter: Integer; Marks: real; Infile: Text; Total: Real; Average: Real; Begin Counter:= 0; Assign(Infile, 'Marks.txt'); Reset(Infile); while not Eof(InFile) do begin ReadLn(InFile, Marks); Counter := Counter + 1; Total := Total + Marks; end; Average := Total/Counter; WriteLn('The average is: ' ,Average:2:2); Close (Infile); End. |
| |||
| Program OhNoNotAnotherOne; var n,i : integer; a : array[1..99] of real; sum : real; begin a[1] := 123.0; a[2] := 127.8; (* etc etc etc *) a[99] := 120.2; sum :=0; i:=0; while i<n do begin i:=i+1; sum := sum + a[i]; end; writeln('Average is ', sum/n); writeln('Eat at Joes'); end. |
![]() |
| Thread Tools | |
| Display Modes | |
| |