I start program with functions in pascal. This is my first program with function in pascal. i compiled this program but my compyler show to me a lot of bugs.Code:program ****; var function artsre(n,i:integer):real; i,n,zb:integer; artsre:real; a:array[1..10] of integer; begin function artsre(n,i:integer):real; for i:=1 to n do begin begin zb:=zb+a[i]; end; artsre:=zb/n; end; write('numbers ? : '); readln(n); for i:=1 to n do begin write('put ',i,' - number : '); readln(a[i]); end; writeln('arithmetic mean is ',artsre); readln; end;
where i make a mistake ? :S
btw excellent forum
Is that the complete program (I don't see the primary begin/end.)? What error messages are you getting? Also, I don't see a using statement.
is it ok now, i solve my bugsCode:program ****; var i,n,zb:integer; a:array[1..10] of integer; function artsre(n:integer):real; begin for i:=1 to n do zb:=zb+a[i]; artsre:=zb/n; end; begin write('numbers ? : '); readln(n); for i:=1 to n do begin write('put ',i,' - number : '); readln(a[i]); end; writeln('arithmetic mean is ',artsre(n):0:2); readln; end.
in the future .... expected a lot of questions from me
i hope i'll find help
I'll certainly do what I can![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks